Customizing the HTTP Agent

 



 

Overview

 

This section explains how to customize certain features, such as SHTML generation, Notification table contents, HTTP error pages, etc. which are used in the HTTP agent.

 

Customizing the SHTML file

 

In general, a HTML page can be split into two parts: head and body. The body section is the core module used to display contents/message with colors, different font style, images, etc. The table information of the agent are shown using HTML table. The following sections will explain how to configure these properties before SHTML file generation.

 

Body Configurations

 

You can customize the way you view the HTML Browser window (the window you see when the index.html page is loaded) . From the Agent Compiler, select Settings->Code Generation->HTML option and customize the background color, Link color, Alink color, Vlink color, background image, and text size of the HTML page.

 

Table Configurations

 

You can customize the way you view the Tables in the HTML Browser window (the window you see when you choose a Table node).

 

The table configurations, such as header color, font color, index color, alignment, border, cell padding, cell spacing, and the number of rows to be displayed in the table can be customized by selecting the Settings ->HTML option of the Agent Compiler.

 

Additional settings for a table can be customized using the function InitHtmlTableConstraints() generated in <WebNMS>/C-Agent/projects/<ProjectName>/agent/source/protocols/http/src/htmltable.c file. This function is used to initialize the table, row, and cell constraints based on the configurations provided for the following :

 

      Cell Constraints Default Value Accepted Values

      Horizontal Alignment

      Left

      Left, Center, Right

      Vertical Alignment

      Center

      top, Center, Bottom

      Cell width

      10

      Integer between 1 and 100

      Cell height

      5

      Integer between 1 and 100

      col span

      1

      Integer between 1 and 100

      row span

      1

      Integer between 1 and 100

      color

      #F0FFF

      Any color

      Row Constraints

      Default Values

      Accepted Values

      Horizontal Alignment

      LEFT

      Left, Center, Right

      Vertical Alignment

      CENTER

      Top, Center, Bottom

      Color

      #F0FFF

      Any color

       

      Table Constraints Default Value Accepted Values

      Alignment

      Center

      Left, Center, Right

      Color

      #F0FFF

      Any color

      Caption

      Center

      Left, Center, Right

      Message

      Table Information

      Any message

      Border

      10

      Any integer between 0 and 10000

      Cell Padding

      5

      Any integer between 0 and 10000

      Cell Spacing

      0

      Any integer between 0 and 10000

      Height

      100

      Any integer between 0 and 10000

      Width

      50

      Any integer between 0 and 10000

The function AddHtmlTableRow() in the htmltable.c file, adds a row in the buffer using the cell constraints and row constraints provided. The function SetHtmlTableProperties() in the htmltable.c file fills the string buffer using the table constraints provided.

 

Customizing Notification

 

You can also customize the way you want to view the notifications generated by the HTTP Agent. To do this, add the code or call the function for customizing the notification buffer in CreateUserHTMLNotification(). This function is defined in <WebNMS>/C-Agent/projects/ <ProjectName>/agent/stubs/submain.c as shown below. Please refer to submain.c for more information.

 

StringBuffer *CreateUserHTMLNotification()

{

/* User can call his functions here */

return NULL;

}

 

Customization Using SSI Tags

 

The supported SSI tags, when applied to an HTML document, provide for interactive real-time features, such as echoing document name, conditional execution based on logical comparisons, etc. Please refer to the document SSI Tags to know more on the usage of these tags.

 

Customizing Error Messages

 

The user can customize error messages by modifying and calling the CreateUserHtmlErrorMessage( ) function in the submain.c source file. Please refer to submain.c for more information.

 

Customization Using htmlprops.txt

 

You can customize the appearance and properties of your HTML page using the htmlprops.txt file present in <WebNMS>\C-Agent\projects\ <Your Projects Directory>\ agent\conf\http directory. By editing the text file, properties of the HTML file, such as background color, alink color, vlink color, and table properties, such as table alignment, number of rows, row and column width and height, etc. can be customized.

 

For Information about customizing notifications, please refer to Readme.txt file present inside the C-Agent\examples\http\customizeerror directory.



Copyright © 2009, ZOHO Corp. All Rights Reserved.