What is an Agent?
An agent is an object compiled into the server which accepts
certain parameters and returns a specific result. For example, an HTTP
agent accepts CGI parameters and returns a MIME compliant result.
More simply, an agent is a program that will act as an interface between the user and some other program or information, making the server more intelligent and useful. For example, a simple agent might be used to take data from the user via a form and save it to a database. A more complicated agent might dynamically create a web site, using information provided by the user for customization.
Agents are more valuable and flexible than traditional Common Gateway Interface (CGI) programs. Since Agents are compiled into the server, they outperform traditional CGI programs, while at the same time being more powerful and flexible.
How do I use an Agent?
Agents are called in much the same way a traditional CGI program would be.
To use the agent, you must first give it a name. Agents can be installed more than once with different names and different properties. You could, for example, have two Time Agents: one giving the time in a 12-hour format, and the other in a 24-hour format.
Notes:
1) All agents, once selected from the administrator's list of available agents, can be edited with a specific start and stop date. This means that you can specify a date for the agent to become active and/or a date for it to become inactive. If you want an agent to start on Monday, Oct 21st, configure the agent then add 10/21/96 to the Start Date field.
2) The convention for naming agents includes a specification that no blanks or extra periods be included in the name. For example: gotohome.agent is correct: go to home.agent is not correct.
The following will briefly describe, using a walkthrough, how to use an agent.
Select Agents from the Configure menu:
This Agent Configuration window displays the currently installed agents. It is in this window that you can Add, Edit, or Remove agents.
Adding An Agent
To add an agent, click the Add button and a dialog box is displayed:
From this list, select the agent you wish to add to your current list of installed agents and press OK.
(Note : More detailed information on each particular agent is discussed later in this document.)
Editing An Agent
To edit an agent, select the agent from the list of installed agents and click Edit to bring up the current settings:
Make any necessary changes to these settings and click OK.
Removing An Agent
To remove an agent, select the agent from the list of installed agents, and click the Remove button.
(Note: While in the Agent Configuration window, you can exit without saving changes by clicking the close button in the upper left corner of the window. To save changes, click the Done button.)
Overview of Included Agents
For each agent we have supplied the HTML tag to use
when coding an agent metatag in your HTML files. It is important to remember
that name denotes the actual name that is specified in the Agent
Configuration window.
For example: The Date agent has the format <NSAGENT="name.agent">. If an administrator has added this agent to the list of installed agents and given it the name LongDate, then the format for the html file would be <NSAGENT="LongDate.agent">. This is typically how agents are referenced in HTML source files.
Fourteen agents are included in this Net Servers release:
Countdown Agent
The Countdown Agent returns the number of days remaining until a certain event/date occurs. For example, there are x number of days until Christmas.
In the Countdown To field, enter the date to which you want the agent to countdown. The date format used is day/month/year i.e. 12/25/96.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
Date Agent
Returns the current date. Allows administrator to specify exactly how to build the date string using pop-up menus (for example, Thursday, June 3, 1996 or 03/06/96).
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
Environment Agent
Returns a standard user environment variable, such as the browser type or host address.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTML Agent
The HTML Agent returns text to a Web page. This agent allows an administrator to use text repeatedly by referring to one agent. Should this text ever need editing, the agent would be opened, edited, the Server updated, and all entries of this text updated accordingly.
For example: a company's address may be mentioned on several Web pages. If the address changed, the appropriate HTML Agent text need only be edited, and all instances to it would be updated.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTML File Agent
The HTML File Agent returns a file to a Web page. This agent allows an administrator to use an HTML file repeatedly by referring only to the agent. Returning a file through an agent saves duplication time that could occur in creating the file again on another Web page or site. It also saves editing time should the file require changes. Since the agent refers to a specific file in a predetermined location, editing the file would edit the Web page or site.
NOTE: The file must be of HTML type.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTTP Form to File Agent
This agent returns information obtained from a form filled out and submitted from the Web page. Each field in the form on the Web page will have a parameter number which when specified in the agent will be retrieved in that order.
For example: a form may be on a Web page for those who wish to have a free sample product sent to them. The first field they enter information into is their name; (parameter 1), the second their address; (parameter 2), and the third their e-mail address; (parameter 3). These parameters are specified in the agent as shown below:
Each time the form is submitted the information for the name, address, and e-mail address fields (Parameters 1, 2, and 3) are retrieved into a text file which may then be input into a database or other storage systems. (Note that the field parameters may be in whatever order is required by the database or other storage device; i.e. Parameter 3 can be before Parameter 1.)
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTTP Image Counter Agent
Keeps a running count of hits to a web page and returns a GIF or JPEG image representing the count. Administrators can specify the type of picture and number of digits to return, and can paste in pictures for the numbers 0 - 9 that will be used to generate the image.
The HTML format for this agent is shown in the following example:
<IMG SRC="name.agent">
HTTP Imagemap Agent
Like a traditional imagemap CGI program, the Imagemap Agent goes to a URL when a portion of an image is clicked on. Administrators can load an image and graphically assign rectangles, circles, and points to lead to different URLs.
Notes:
1) To load a picture, click the Load Picture button. You will be requested to specify a file (.PICT); however, in the html source file where the imagemap is referenced you would refer to that file as a .JPG. Therefore both a PICT and a JPG are required to be at that location.
2) In the Default URL field enter the URL to which a user is taken if they click anywhere other than the rectangle, circle, or point. Usually this is the same page they are on.
3) After adding a rectangle, circle, or point you are then required to enter the URL field which when that item is clicked on by the user it will take them to a particular URL.
4) Rectangles, circles, and points dimensions may be altered after being placed by editing the dimension fields in the upper section of this window.
The HTML format for this agent is shown in the following example:
<A HREF="name.agent"> <IMG SRC="name.jpg" ISMAP BORDER=2 > </A>
HTTP Page Alias Agent
The HTML Page Alias Agent is a convenient way of providing an alternate description of an HTML Address reference. For example, if your company's web pages provided an easy mechanism to return to the home page, then changing the location or name of your home page would necessitate a change in every document containing a reference to it. With the HTML Alias Agent, all you need to do is create a separate file, which is the target of the reference above, and place within it the HTML Alias Agent metatag. The reference provides a link to the NSAGENT metatag and the agent itself provides the link back to the home page. With this mechanism you can change multiple links from one central, easily updated location.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTTP Redirect Agent
Redirects user to different URLs based on their browser type. Allows administrator to use wildcards to detect browser types.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
Random HTML Agent
Returns different HTML text based on odds specified by the administrator. Allows administrator to enter or paste in HTML and enter percentages.
For example: a contest is being put on by the administrator. The individuals browsing this Web site and playing the contest will click a box labeled Clues. Each time this is done this agent returns HTML text based on the percentages specified.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTTP Text Counter Agent
Keeps a running count of hits to a web page and returns a string with the count. Administrators can specify the number of digits to return, and the current count.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTTP Time Agent
Returns the current time. Allows administrator to specify exactly how to build the time string through pop-up menus (for example, 4:30 AM or 16:30:00 AM).
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">
HTTP Time of Day Agent
Returns a string appropriate to the time of day such as "Good Morning". Allows administrator to specify different strings to return between different times.
The HTML format for this agent is shown in the following example:
<NSAGENT="name.agent">