Previous Page TOC Next Page



- 9 -
Advanced Query Forms and Reports


In this chapter, you'll explore how to add hit highlighting to your Index Server reports. You'll learn how Index Server applications can be integrated with your other Web applications that use CGI, ISAPI, and IDC. This discussion is followed with an example of how a database query application using IDC can be integrated with an Index Server query application. The remainder of the chapter demonstrates how your Index Server applications can be made more functional and interactive using ActiveX controls and VBScript. A full-fledged query-form example that implements several controls and simple VBScript subroutines will show you just how easy it can be to spice up your applications.

Using Hit Highlighting


In Chapter 8, "HTML Extension Files," the concept of inline hit highlighting, also known as webhits, was briefly introduced. Hit highlighting was added in version 1.1 of Index Server and extends the functionality of .htx report-template files by allowing users to view the exact portions of documents in the result set that satisfy the query restriction submitted by the user. Users can preview precisely targeted portions of the document and determine whether the content truly matches their needs without having to view the document in its entirety. This can be an especially useful time saver when querying sites serve large documents.

Figure 9.1 illustrates the results generated by the sample query form that comes as part of the Index Server installation.

Figure 9.1. The results of a query using the Index Server sample query form on a test Web Site. Note the hypertext link Highlight Hits below each result in the result set.

Notice in Figure 9.1 that each result in the result set contains the Highlight Hits hypertext link. A Common Gateway Interface (CGI) program is executed when the user clicks this link, which generates HTML pages containing a list of hits that satisfy the query restriction. Each listed hit is displayed with several lines of text that precede and follow the hit in the respective document, which allows the user to determine whether it is worthwhile to review the entire document. Additionally, each of these hits is displayed in italicized red text by default.

Figure 9.2 illustrates the webhits page that is generated by clicking the Highlight Hits link for the first result in Figure 9.1. Notice that the hit-highlighting program generates an HTML page that displays three portions of the document containing hits that satisfy the query. In each instance, the words swank or Web database are highlighted to indicate that these query restrictions were matched.

Figure 9.2. Hit highlights for the first result illustrated in the result set of Figure 9.1.

The following sections will guide you through the syntax used to invoke the hit-highlighting CGI program, the parameters that can be used to customize how webhits are displayed, and how hypertext links to hit highlighting can be added to query results pages (as illustrated in Figure 9.1).

Syntax Used to Invoke the Webhits CGI Program


Hit highlighting is implemented through the use of a CGI program named Webhits.exe, which is invoked from the user's browser using the URL syntax http://servername/vpath1/vpath2?params.

Servername refers to server where the executable resides, such as www.omniscient.com. Vpath1 refers to the virtual path where the Webhits.exe CGI executable resides. This must be a directory with execute access. This program is installed in /scripts/samples/Search by the default when Index Server installed. Vpath2 refers to the virtual path where the document to be highlighted resides (/wwwdbdev, for example). Params refers to any webhits parameters that are appended following the ? in the URL. webhits parameters are used to customize webhits queries. For example, the CiRestriction parameter is used to pass the query to be used for hit highlighting. Parameters are specified as name=value pairs concatenated with the ampersand character as follows:


Param1=Value1&Param2=Value2&. . .&ParamN=ValueN

Anything appended after the ? in the URL must be in escaped format and whitespace can occur anywhere in the appended information.



Because Webhits.exe is a CGI prograrm, it relies on information that is stored in the following CGI environment variables:

PATH_TRANSLATED is set to the physical path of the document to be highlighted when the CGI program is invoked from a Web browser.

PATH_INFO is set to the virtual path of the document to be highlighted when the CGI program is invoked from a Web browser.

QUERY_STRING is set with information that follows the question mark (?) in the URL. The webhits CGI program subsequently parses this string to extract parameter names and values.



A Simple Webhits Query

To demonstrate how an actual webhits query URL is formatted, let's look at a simple example that only uses a single webhits parameter and standard document properties. Suppose you have a query restriction that searches for specific content, a specific document author, and a file size exceeding a specific value:


database AND @DocAuthor = Drew Kittel AND @size > 1000

In escaped form, spaces are replaced with %20, the equal (=) sign is replace with %3D, and the greater-than sign (>)is replaced with %3E. Therefore, this query restriction translates to the following:


database%20AND%20@DocAuthor%20%3D%20Drew%20Kittel%20AND%20@size%20%3E%201000

Now suppose you want to direct this query at a specific document in the corpus (vpath2):


/wwwdbdev/wwwdbdevch10.htm

Finally, suppose that the webhits CGI program resides on the server (servername)


www.omniscient.com

at the virtual path (vpath1)


/scripts/Webhits.exe

To perform hit-highlighting on the document, the following URL is constructed using the syntax previously described:


http://www.omniscient.com/scripts/webhits.exe/wwwdbdev/wwwdbdevch10.htm?CiRestriction= database%20AND%20@DocAuthor%20%3D%20Drew%20Kittel%20AND%20@size%20%3E%201000

Webhits Parameters


In the previous sections, you learned how a webhits URL is constructed and how webhits parameters can be specified to customize the webhits query on a document. While only one parameter (CiRestriction) is required in the URL, several other recommended and optional webhits parameters are also available. Table 9.1 lists and describes all valid webhits parameters.

Table 9.1 Webhits Parameters

Parameter Name Parameter Description
CiRestriction This is a required parameter. The format of this parameter is CiRestriction=Query. Query must be a string value that specifies the query to be used for hit highlighting on a document. Note that the string must be in escaped form, which means that all spaces, equal signs, and other special characters (>, <, and so on) are replaced by their ASCII code equivalents. When specified in an .htx file, the keyword <%EscapeURL%> can be used to escape the query string.
CiQueryFile This parameter is required only for queries using custom properties. It is optional in all other cases. The format of this parameter is CiQueryFile=VirtualPath. VirtualPath specifies the virtual path to an .idq file containing the [Names] section, which describes custom document properties referenced in the query. Attempting to perform hit highlighting using a query with custom properties and without specifying an .idq file results in the generation and display of a No such property error message.
CiUserParamNumber This parameter is optional. The format of this parameter is CiUserParamNumber=Value (where Number is a value between 1 and 10).

These parameters provide a means of passing information to the .htw webhits template file specified by CiTemplateFile. The value of these parameters replaces placeholders with corresponding names in the .htw file.
CiTemplateFile This parameter is optional, but its use is highly recommended. The format of this parameter is CiTemplateFile=VirtualPath. VirtualPath specifies the virtual path to a template file used to generate the HTML output of webhits results. Typically, these files are given an extension of .htw. The use of these template files allows you to customize how webhits reports are displayed. The structure of .htw files is the same as .htx report-template files except that if. . .then. . .else processing is not supported. Also, in Index Server v1.1, any text between <%BeginDetail%> and <%EndDetail%> is ignored. In other words, the detail section is simply used as a placeholder for the hit-highlight data. Another difference is that there are only a limited number of replaceable parameters. (<%CiRestriction%>, <%CiURL%>, and <%CiUserParam1%> through <%CiUserParam10%>).
<%CiURL%> This parameter acts as a placeholder in the .htw file and is replaced with the virtual path for the document being highlighted.
<%CiRestriction%> This parameter acts as a placeholder in the .htw file and is replaced with the value of the query restriction (CiRestriction=Query) passed as part of the webhits query string.
<%CiUserParamNumber%> This parameter acts as a placeholder in the .htw file and is replaced with the corresponding value of the CiUserParamNumber parameter passed as part of the webhits query string. Number represents a value between 1 and 10.
CiHiliteType This parameter is optional. The format of this parameter is CiHiliteType=Option. Option specifies the type of highlight to be presented to the user. The value of Option is either Full or Summary. Summary is the default value. Summary causes the display of short excerpts of the document surrounding words that match the query restriction. Full causes the entire document to be highlighted and displayed. Note, however, that full-fidelity highlighting is not performed. Only the text portions of the document are highlighted and displayed. That means this option is useful primarily for documents that are mostly textual. Full also causes two types of navigational aids (bookmarks and brackets) to be added to the displayed highlight. Bookmarks are added to allow navigation between return hits. The top of the HTML document generated by the CGI program is tagged as #CiTag-1. Hits in the returned HTML are bookmarked starting with #CiTag0. Each hit in the returned document is surrounded with double angle brackets (<< hit >>). Clicking << returns the user to the previous hit, while clicking >> takes the user to the next hit in the document.
CiMaxLineLength This parameter is optional. The format of this parameter is CiMaxLineLength=Number. Use of this parameter causes text in the HTML document returned by webhits to be pre-formatted using the <PRE></PRE> tag pair. Number is used to specify the maximum length of formatted lines of text in the returned document. When Number is exceeded by the text line being formatted, the line of text is broken at the next word boundary.
CiHiliteColor This parameter is optional and can be specified in two ways. The first format is CiHiliteColor=24-bit color mask where 24-bit color mask specifies a color mask such as 0xHHHHHH (where H represents hexadecimal digits). The second format of this parameter is CiHiliteColor=Color where Color is one of the colors in the set {red, green, blue, yellow, black}. This parameter is used to specify the color used when displaying highlighted hits that match the query restriction. If the parameter is not specified, red is used by default.
CiBold This parameter is optional. The format of this parameter is CiBold=Value. This parameter is used to specify that the highlighted text be displayed as bold. Any non-null Value will cause bold highlights to be displayed.
CiItalic This parameter is optional. The format of this parameter is CiItalic=Value. This parameter is used to specify that the highlighted text be displayed as italic. Any non-null Value will cause italicized highlights to be displayed.

How to Add Webhits Links to an .htx Template


To invoke the Webhits.exe CGI program, you must create a hypertext link that references the program from the HTML results presented to the user. This is done by adding code to the <%BeginDetail%><%EndDetail%> section of the .htx report-template file used to create the HTML query results pages. The following snippet of code is a modified version of the queryhit.htx sample that is distributed with Index Server. Figure 9.3 illustrates how adding highlight links is accomplished in a frame-based query utility.


. . . code statements preceding <%begindetail%> in .htx file

<%begindetail%>

. . . code to create doctitle link

. . . code to create doc abstract

. . . code to create full doc path link

# add link for hit highlighting this document

<a href="http://<%server_name%>/scripts/samples/search/webhits.exe<%escapeURL vpath%>?CiRestriction=<%escapeURL CiRestriction%>&CiTemplateFile=/scripts/test_web/basic_queryhit.htw&CiQueryFile=/scripts/test_web/basic_queryhit.idq&CiUserParam3=<%escapeURL HTMLQueryForm%>" target="rbottom"><b>Highlight Hits</b></a>

<%enddetail%>

. . . code statements following <%enddetail%> in .htx file

Compare this code with the previously presented syntax for a webhits query URL and note how all components (servername, vpath1, vpath2 and escaped param=value pairs) of that syntax are represented. A few additional notes about this code follow.

Figure 9.3. Adding Hit Highlights links to HTML output created by .htx files.

Using .htw Files to Customize Webhits Output


A webhits template file is used to generate the HTML output of webhits results. Typically, these files are given an extension of .htw. These template files allow you to customize how webhits reports are displayed. The structure of .htw files is the same as .htx report-template files except for the following:

In the previous section, you learned how links for hit highlights can be added to an .htx file. In the example presented, the CiTemplateFile parameter was used to specify the basic_queryhit.htw webhits template file to be used for formatting the highlighted information to be presented. Listing 9.1 contains the code for this template.

Listing 9.1. Contents of the basic_queryhit.htw webhits template file.


<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=iso-8859-1">

<meta name="GENERATOR" content="Microsoft FrontPage 2.0">

<title></title>

</head>

<body bgcolor="#E8E8E8">

<!-- Print a header that displays the cirestriction and

document vpath -->

<table border="1" width="98%">

 <tr>

   <th><em><strong>Query:</strong></em>

     <strong><font color="#FF0000" size="4" face="Arial"><%CiRestriction%>

     </strong></font><strong><em>on document:</strong></em>

     <strong> <font color="#FF0000" size="4" face="Arial"><%CiUrl%></strong>

     </font>

   </th>

 </tr>

 <tr>

   <td>

    <%begindetail%><%enddetail%>

  </td>

 </tr>

</table>

</body>

</html>

Notice that this file looks like a very simple .htx file except that no code is included in the detail section. HTML tables and horizontal rules (<hr>)are used to nicely format each hit in the output. Additionally, the table header uses the CiRestriction and CiURL parameter values passed in the query URL query string to remind the user of the query restriction and document being used for hit highlighting.

Figure 9.3 illustrated how the Highlight Hits link was displayed in a frames-based query page. When this link is clicked by the user, the webhits program uses the code in the basic_queryhit.htx file to format the results. The table-formatted result is illustrated in Figure 9.4.

Figure 9.4. An .htw file can be used to customize the HTML output created by Webhits.exe.

Integrating Index Server with Other Applications


In the previous sections, you learned how hit highlighting could be added to your reports generated by your Index Server applications by adding references to the pre-packaged Webhits.exe CGI program provided with Index Server. This use of a CGI program from an Index Server application highlights a very interesting and powerful aspect of Index Server—the capability and flexibility to integrate other applications with your Index Server applications.

What this means is that you can develop your own applications whose results are used to create customized, dynamic, on-the-fly HTML query forms and query restrictions for your Index Server applications. These applications can be developed using the following:

For example, you could create an IDC application to query a database and use the results to create a secondary query form for use with Index Server. Not only that, the database wouldn't even need to be on a local machine. Likewise, results from Index Server queries can be manipulated to create dynamic forms for other applications as well. For example, results from an Index Server query could be used to dynamically create SQL statements used to extract information from a database. The possibilities are endless. With some imagination and creativity, you can easily develop applications that integrate Index Server with legacy databases, spreadsheets, statistical packages, and so on.

Integrating IDC and Index Server—A Simple Example


You have already seen how Index Server applications can be integrated with CGI applications to provide additional functionality to your users. This section presents a simple example of how an IDC application can be used to dynamically create query forms for subsequent use with Index Server. This example uses the IIS Internet Database Connector to extract names of authors of specific types of books from a publisher's database. These names are then used to create a query form that allows users to select an author and provide additional query restrictions. This form is submitted to Index Server, which searches the corpus for documents referencing the author and matching other restrictions entered by the user.

We don't intend to explain all the details of IDC applications development. However, as you learned in Chapter 7 ("Internet Data Query Files"), the use of .idq and .htx files was based on the IDC model of interaction with IIS. Therefore, you should be able to follow this example fairly easily.



Resource

Additional detailed information about IDC can be found in Chapter 8, "Publishing Information and Applications," in the online documentation included with IIS




Resource

Microsoft provides a free GUI-based publishing utility called dbWeb, which is used to quickly publish open database connectivity (ODBC) databases via IIS and IDC on the Web. dbWeb utilizes IDC but does not require extensive knowledge of SQL, HTML, or other programming methodologies. As such, it provides a powerful mechanism for the creation of .idc and .htx files (in addition to the many other database creation and management functions it provides) that can be integrated with your Index Server applications.

dbWeb is free and can be downloaded from http://www.microsoft.com/intdev/dbweb/dbweb.htm.



Invoking the .idc File

.idc files can be invoked by specifying the path to an .idc file in the action URL for an HTML form or in an href anchor for an HTML hyperlink. For this example, we have created a link in the frames-based utility illustrated in Figure 9.5. The following code creates the link to the Database Integration example.


<a href="/scripts/test_web/idcexample.idc?">

Figure 9.5. A frames-based query tool that provides links to a variety of query examples developed for this book, including an example of a IDC-Index Server integration.

Clicking the Database Integration link invokes the idcexample.idc file, which is used by IIS to perform a query against a database. Note that no parameters were appended to the URL in this case. However, like .idq files, IDC files can accept and perform substitutions of parameters passed as appended query strings or from HTML forms.

Contents of the .idc File

The .idc file is used to specify a SQL Statement or statements to be used for querying a database. There are also several optional parameters and ODBC fields that can be set in .idc files, but Listing 9.2 simply illustrates the use of the three required fields (Datasource, Template and SQLStatement).

Listing 9.2. Contents of the idcexample.idc file.


Datasource: Web SQL

Username: sa

Template: idcexample.htx

SQLStatement:

+SELECT au_lname, au_fname, type, title

+FROM pubs.dbo.authors a,  pubs.dbo.titleauthor ta, pubs.dbo.titles t

+WHERE   a.au_id = ta.au_id and ta.title_id = t.title_id and(t.type like '%%comp%%' or t.type like '%%bus%%' or t.title like '%%comp%%')

+ORDER BY au_lname

Datasource refers to the System DSN specified using ODBC application under Control Panel. In this case, we associated Web SQL with the local Microsoft SQL Server database on our server.

Template refers to the .htx file used to format the results from the database query.

SQLStatement refers to the SQL query submitted to the database. The + signs simply indicate a continuation to the next line in the file. In this example, the SQL statement used queries the publisher's database for all authors of all computer and business books as well as all books that have a word like computer in the title.

Contents of the .htx File

.htx files used with IDC applications are very similar to those used for Index Server applications. Basically, they specify how database results are to be formatted as HTML and displayed to the user. Because they specify HTML output, they can also be used to dynamically create HTML forms based on the results of the database query. This means that static query forms are a thing of the past. Instead, forms can be dynamically created and tailored to a user's functional and informational requirements. Figure 9.6 illustrates the results of the database query, which were formatted to create a secondary HTML form used to make an Index Server query.

Figure 9.6. Results of a database query can be formatted in an .htx file to dynamically create an HTML form for use with Index Server.

Listing 9.3 contains the content of the .htx file used to format the results of the database query performed by the .idc file in the previous section. This listing demonstrates how results of an .idc query can be formatted for use as another HTML form that is in turn used to make queries to Index Server.

Listing 9.3. Contents of the idcexample.htx file.


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=iso-8859-1">

<meta name="GENERATOR" content="Microsoft FrontPage 2.0">

<title>Authors</title>

</head>

<body bgcolor="#E8E8E8">

<form action="/scripts/test_web/author_queryhit.idq" method="GET">

<center>

<strong>Select an Author From Our Database of Computer-Related Books:</strong>

<BR>

<select name="UserAuthor" size="5">

<%begindetail%>

<option value="<%au_lname%>"><%au_lname%>, <%au_fname%> </option>

<%enddetail%>

</select> <B><EM>OR</EM></B>

</center>

<center>

<strong>Enter an Author's Last Name:</strong><BR>

<input type="text" size="60" maxlength="100" name="UserAuthor2">

<P>

<input type="hidden" name="CiMaxRecordsPerPage" value="10">

<input type="hidden" name="CiScope" value="/">

<input type="hidden" name="TemplateName" value="basic_queryhit">

<input type="hidden" name="CiSort" value="rank[d]">

<p align="center">

    <font size="2" face="Arial"><strong>Enter an optional query restriction

    </strong></font>:</p>

    <div align="center"><center><table border="1" cellspacing="1"

    width="50%" bgcolor="#A4B0BD" bordercolor="#008080"

    bordercolordark="#008080" bordercolorlight="#008080">

        <tr>

            <td align="center" colspan="2" width="80%"><input

            type="text" size="60" maxlength="100"

            name="CiRestriction"></td>

        </tr>

        <tr>

            <td align="center"><input type="submit"

            value="Execute Query"> <input type="reset" name="1"

            value="Clear"></td>

        </tr>

    </table>

    </center></div>

</form>

</body>

</html>

A few notes about this file are as follows:

When the user submits the form, parameters are substituted in the .idq file referenced, Index Server performs the query, and an .htx report template file is used to format the results. Figure 9.7 illustrates the output for such a query.

Figure 9.7. The final results of a two-stage query IDC-Index Server application. The first stage pulled author information from a database and created a form. The second stage used inputs to the form to perform an Index Server query.

Spicing Up Your Applications with ActiveX Controls and VBScript


Technologies geared towards Internet and Web applications have been improving by leaps and bounds. With the introduction of the HTML 3.2 <OBJECT> tag, ActiveX controls, and client-side Visual Basic and Java scripting within browsers such as Microsoft Internet Explorer 3.0, developers have the tools to develop fully interactive Web applications. With the availability of these new technologies, the Web browser is rapidly becoming a full-fledged GUI development environment.

Previously, Web application developers were shackled by the restrictions of HTML 2.0 form. These objects allowed virtually no client-side processing of user inputs or actions (such as a mouse click). Instead, all data-validation, conditional-logic, and forms-input processing had to take place on the server. This took more time, consumed limited network bandwidth and server resources, and severely hampered the level of interactivity a user could have with an application on his Web browser.

Using HTML 3.2 <OBJECT> tags and a growing suite of available ActiveX controls, developers are able to create highly interactive applications, including



Resource

The Microsoft ActiveX Control Pad is an Web-authoring tool that allows developers to add ActiveX controls and ActiveX scripting (using VBScript or JavaScript) to HTML pages with an easy-to-use, graphical interface, point-and-click ease. The Control Pad comes complete with several ActiveX controls that can be added to your HTML code to enliven your forms and create more functional, interactive applications. The ActiveX Control Pad is free and can be downloaded from http://www.microsoft.com/workshop/author/cpad.

This site also contains links to tutorials, technical white papers, FAQ samples, and a user discussion/support newsgroup.

Also, you should visit the ActiveX Gallery site at http://www.microsoft.com/activex/controls to check out many of the controls offered by third-party vendors.


What is so significant about these controls and objects? Well, two things really. First, most of these controls and objects provide a rich set of modifiable parameters that allow developers to tailor how the controls are presented to the user. For example, size, relative placement, color, font styles, labeling and captions, and so on can be initialized and modified at runtime. Second, most of these objects and controls are dynamic in that they respond to events. These events can be time-related events (such as a specific date or time) or user-events (such as a mouse-click on the object). The fact that these objects and controls respond to events allows developers to create response functions associated with specific events. These response functions are client-side VBScript or JavaScript programs that take some action based on the type of event and perhaps the state or value of some object's parameters. This functionality allows developers to break through the constraints of older HTML and browser technology and create applications that perform the following:

All of this can be done strictly on the client side without communication with the server until a form requires the application-specific processing that the server provides, such as Index Server queries, database lookups, or CGI and ISAPI programs.



Resource

A wealth of information about Visual Basic Scripting can be found at http://www.microsoft.com/vbscript.

This site includes links to VBScript samples and examples illustrating how VBScript can be incorporated with HTML 3.2 form objects and ActiveX controls to jazz up your Web applications. There are also links to a VBScript FAQ and a downloadable tutorial and language reference.



Implementing ActiveX Controls and VBScript—A Simple Query Form Example


In this section, you will get a glimpse of the greatly improved functionality and interactivity that ActiveX controls and VBScript can bring to your Index Server applications. In this example, several familiar HTML form objects and the following ActiveX controls are implemented:

Listing 9.4 provides a full listing of the HTML code, ActiveX controls, and VBScript procedures used to create the sample form seen in Figure 9.8. This listing demonstrates how ActiveX Controls and VBScript can be added to HTML forms to create highly interactive Index Server query forms.

Listing 9.4. Contents of the vbform.htm file.


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=iso-8859-1">

<meta name="GENERATOR" content="Microsoft FrontPage 2.0">

<title>VBTEST</title>

</head>

<body bgcolor="#FFFFFF">

<p align="center">&nbsp;<font color="#0000A8" size="5"

face="Wide Latin"><strong>I</strong></font><font color="#0000A8"

size="4" face="Wide Latin"><strong>NDEX </strong></font><font

color="#0000A8" size="5" face="Wide Latin"><strong>S</strong></font><font

color="#0000A8" size="4" face="Wide Latin"><strong>ERVER </strong></font><font

color="#0000A8" size="5" face="Wide Latin"><strong>Q</strong></font><font

color="#0000A8" size="4" face="Wide Latin"><strong>UERY </strong></font><font

color="#0000A8" size="5" face="Wide Latin"><strong>F</strong></font><font

color="#0000A8" size="4" face="Wide Latin"><strong>ORM</strong></font></p>

<form action="/scripts/vbtest.idq" method="GET" name="MainForm">

 <div align="center"><center>

 <table border="1" bgcolor="#A4B0BD" bordercolor="#008080"

   bordercolordark="#008080" bordercolorlight="#008080">

     <tr>

         <td align="center"><div align="center"><center>

         <table border="1" cellspacing="1" bgcolor="#A4B0BD"

         bordercolor="#008080" bordercolordark="#008080"

         bordercolorlight="#008080">

             <tr>

                 <td align="center"><font color="#FFFFFF"

                 size="3" face="Arial"><strong>Enter a query

                 restriction below</strong></font><font

                 color="#FFFFFF" size="4" face="Arial">:</font>

                 </td>

                 <td align="right">

                 <input type="checkbox" name="cbEnum" value="ON">

                 <strong>Allow Enumerated Search?</strong>

                 </td>

             </tr>

             <tr>

                 <td colspan="2" width="80%">

                 <input type="text" size="85" maxlength="100"

                  name="CiRestriction">

                 </td>

             </tr>

         </table>

         </center></div></td>

     </tr>

     <tr>

         <td align="center"><div align="center"><center>

         <table border="0">

             <tr>

                 <td align="center" width="50%">

                  <input type="radio" checked name="rbbool" value="AND">

                  <font face="Wide Latin"><strong>AND </strong></font>

                 </td>

                 <td align="center" width="50%">

                   <input type="radio" name="rbbool" value="OR"><font

                   face="Wide Latin"><strong>OR</strong></font>

                 </td>

             </tr>

         </table>

         </center></div></td>

     </tr>

     <tr>

         <td align="center"><div align="center"><center>

         <table border="0">

             <tr>

                 <td align="center" width="33%"><font size="3"

                   face="Wide Latin"><strong>Filesize</strong></font>

                 </td>

                 <td align="center" width="20%">

                   <object id="lblInequal" name="lblInequal"

                     classid="clsid:978C9E23-D4B0-11CE-BF2D-00AA003F40D0"

                     align="middle" border="0" width="16" height="24">

                     <param name="ForeColor" value="128">

                     <param name="BackColor" value="16777215">

                     <param name="Caption" value="&gt;">

                     <param name="Size" value="423;635">

                     <param name="FontName" value="Wide Latin">

                     <param name="FontEffects" value="1073741825">

                     <param name="FontHeight" value="360">

                     <param name="FontCharSet" value="0">

                     <param name="FontPitchAndFamily" value="2">

                     <param name="FontWeight" value="700">

                    </object>

                 </td>

                 <td align="center" width="34%"><div align="center"><center>

                 <table border="1" bgcolor="#A4B0BD" bordercolor="#008080"

                  bordercolordark="#008080" bordercolorlight="#008080">

                     <tr>

                         <td align="center" width="8%">

                         <object id="btnFSize" name="btnFSize"

                          classid="clsid:79176FB0-B7F2-11CE-97EF-00AA006D2776"

                          align="baseline" border="0" width="16" height="31">

                          <param name="Size" value="418;781">

                          <param name="Min" value="5000">

                          <param name="Max" value="100000">

                          <param name="Position" value="5000">

                          <param name="SmallChange" value="10000">

                         </object>

                         </td>

                         <td align="center" width="20%">

                         <object id="txtFSize" name="txtFSize"

                          classid="clsid:8BD21D10-EC42-11CE-9E0D-00AA006002F3"

                          align="baseline" border="0" width="127" height="25">

                          <param name="VariousPropertyBits" value="746604571">

                          <param name="BackColor" value="13290186">

                          <param name="ForeColor" value="3084984">

                          <param name="BorderStyle" value="1">

                          <param name="Size" value="3329;670">

                          <param name="SpecialEffect" value="0">

                          <param name="FontName" value="Wide Latin">

                          <param name="FontEffects" value="1073741825">

                          <param name="FontHeight" value="240">

                          <param name="FontCharSet" value="0">

                          <param name="FontPitchAndFamily" value="2">

                          <param name="ParagraphAlign" value="2">

                          <param name="FontWeight" value="700">

                         </object>

                         </td>

                     </tr>

                 </table>

                 </center></div></td>

                 <td><font size="4" face="Wide Latin">

                      <strong>Bytes</strong></font>

                 </td>

             </tr>

         </table>

         </center></div></td>

     </tr>

     <tr>

         <td align="center"><input type="submit" value="Execute Query">

          <input type="reset" name="1" value="Clear">

         </td>

     </tr>

 </table>

 </center></div><p align="center">&nbsp;</p>

 <p align="center">&nbsp;</p>

 <p align="center">&nbsp;</p>

 <p align="center">&nbsp;</p>

 <p align="center">&nbsp;</p>

 <p align="center">&nbsp;</p>

</form>

<script language="VBScript">

<!--

Dim F

Set F = Document.MainForm

btnMin = 5000

btnMax = 100000

F.btnFSize.value = btnMin

F.txtFSize.value = btnMin

sub btnFSize_SpinUp()

   F.txtFSize.value = F.btnFSize.value

end sub

sub btnFSize_SpinDown()

   F.txtFSize.value = F.btnFSize.value

end sub

sub lblInequal_Click()

   if F.lblInequal.caption = ">" then

      F.lblInequal.caption = "<"

   else

      F.lblInequal.caption = ">"

   end if

end sub

sub cbEnum_OnClick()

   if F.cbEnum.Checked then

     MsgBox "Please be advised that enumerated searches can take a long time to complete and use valuable system resources.  If an enumerated search is not absoultely required, please change your selection"

   end if

end sub

-->

</script>

</body>

</html>

Figure 9.8 illustrates the Index Server query form created by the vbform.htm code in Listing 9.4.

Figure 9.8. An Index Server query form that implements ActiveX controls and VBScript subroutines to respond to user actions.

A few notes about this form are as follows:

Figure 9.9. This pop-up warning created by a VBScript subroutine when a user elects to allow enumerated searches on the form presented in Figure 9.8.



Resource

Additional information (including occasional free beta versions) about FrontPage can be found at the FrontPage site (http://www.microsoft.com/frontpage).


An .idq file can now be developed to handle a user's inputs to the form. The .idq file should use conditional statements to properly construct the CiRestriction based on the value of parameters passed from the form. The creation of this file is left as an exercise for you.

Summary


This chapter touches on a number of subjects with a common theme: improving the functionality of your Index Server applications. The chapter begins with a discussion of hit highlighting and how webhits are added to Index Server query reports. Next, you learned that Index Server applications need not operate in isolation, but rather can be integrated with other applications. This was reinforced with an example integrating a database query (using IDC) with an Index Server query. The remainder of the chapter dealt with improving the functionality and interactivity of your applications using ActiveX controls and VBScript. The query form example illustrated how a few controls and simple VBScript subroutines can significantly spice up an application.

Previous Page Page Top TOC Next Page