|
In Chapter 21, "Project Case Study—Creating a Worldwide Search Application for InfoTools Inc.," you learned about the case study at InfoTools, Inc. This company requires a worldwide search application to help manage its sales in an efficient manner.
In this chapter, you'll learn how to develop a worldwide search application using ColdFusion MX. First, you'll learn how to design the Web pages for the application. Then, you'll learn how to associate the programming logic with each of these pages.
Before you start designing the Web pages,-create a directory named ProjectFive. You'll store all the Web pages and code files in this directory.
To provide a consistent look to all the Web pages, a Cascading Style Sheet (CSS) named Project5.css is used. To apply the specific style to a page, the CLASS attribute of the various HTML tags is used.
Create a basic HTML page and save it as ManagingCollections.cfm in the ProjectFive directory. Modify the HTML code for the page to set the title as InfoTools Search Application.
Next, create various controls on the Managing Collections page, as shown in Figure 22.1. This page is the start page for the administrator. Using this page, the administrator can perform all the functions on the collections that are already created. This page also provides links to create new collections.
Figure 22.1: The design of the Managing Collections page.
The Managing Collections page contains the following controls:
Two Form controls to act as containers for the other controls on the page.
Two HTML Table controls to store the List controls and the Text Field control.
One Text Field control to accept the interaction ID.
Six Button controls to perform different functions, such as refreshing, updating, and deleting the collection.
There are two forms created on the Managing Collections page. The HTML Table controls are placed within these Form controls. Set the properties of the Form controls as listed in Table 22.1.
Control | Property | Value |
---|---|---|
Form1 | Name | One |
Forml | Action | ProcessCollections.cfm |
Form1 | Method | POST |
Form2 | Name | Two |
Form2 | Action | ProcessDocCollections.cfm |
Form2 | Method | POST |
Table 22.2 lists the properties assigned to the Text Field control used in the Managing Collections page in the form named One.
Control | Property | Value |
---|---|---|
Text Field1 | Name | InteractionID |
Text Field1 | Size | 10 |
Text Field1 | Type | Text |
Text Field1 | MaxLength | 3 |
Text Field1 | Validate | Integer |
Text Field1 | Message | Interaction ID should be Numeric |
Table 22.3 lists the properties assigned to the List controls used in the Managing Collections page in the forms named One and Two.
Control | Property | Value |
---|---|---|
List1 | Name | Selected_Collection |
List1 | Size | 4 |
List1 | Query | get_database_collections |
List1 | Value | CollectionName |
List1 | Display | Combined |
List1 | Required | YES |
List1 | Message | Select a Collection Description Before Clicking the Action Buttons |
List2 | Name | Selected_Collection |
List2 | Size | 4 |
List2 | Query | get_documents_collections |
List2 | Value | CollectionName |
List2 | Display | Combined |
List2 | Required | YES |
List2 | Message | Select a Collection Description Before Clicking the Action Buttons |
Table 22.4 lists the properties assigned to the Button controls used in the Managing Collections page in the forms named One and Two. All the Button controls are of the type submit. All these Button controls have the same name because only one of them is used at a time.
Control | Property | Value |
---|---|---|
Button1 | Name | btnSave |
Button1 | Type | Submit |
Button1 | Value | Refresh Collection |
Button2 | Name | btnSave |
Button2 | Type | Submit |
Button2 | Value | Update Collection |
Button3 | Name | btnSave |
Button3 | Type | Submit |
Button3 | Value | Remove Specific Entry |
Button4 | Name | btnSave |
Button4 | Type | Submit |
Button4 | Value | Optimize Collection |
Button5 | Name | btnSave |
Button5 | Type | Submit |
Button5 | Value | Repair Collection |
Button6 | Name | btnSave |
Button6 | Type | Submit |
Button6 | Value | Delete Collection |
Apart from these controls, the Managing Collections page contains two links that are used to create new collections.
The Create Document Collections page is used to create new document-based collections. The different parameters required to create the document collections are provided on this form. Based on these parameters, a new collection is created.
Create a new Web page and name it ManagingDocCollections.cfm. Figure 22.2 displays the design of the Create Document Collections page.
Figure 22.2: The design of the Create Document Collections page.
As shown in Figure 22.2, this page contains a Form control, an HTML Table control, and six Text Field controls. The text fields placed in the table also have corresponding labels that are generated using HTML. The complete code for this Web page is discussed in "The Workings of the Worldwide Search Application" later in this chapter. To summarize, the Create Document Collections page contains the following controls:
An HTML Table control to contain the Text Field and List controls.
Four Text Field controls to accept the details for creating the new collection, such as the name of the collection and the path of the documents to be included in the collection.
Two List controls. One control is used to display the file extensions of the files to be selected for a collection. The other is a Drop-Down List control to specify whether or not the files in the subdirectories of the directory specified as the main path should be included.
A Button control to create the new collection and populate it by indexing the files to be included.
After creating the controls, you need to set their properties. Table 22.5 lists the properties assigned to the Text Field controls on the page.
Control | Property | Value |
---|---|---|
TextField1 | Type | Text |
TextField1 | Name | CollectionName |
TextField1 | Size | 50 |
TextField1 | MaxLength | 50 |
TextField1 | Required | Yes |
TextField1 | Message | Collection Name is required to create a Collection |
TextField2 | Type | Text |
TextField2 | Name | PathToCollection |
TextField2 | Size | 50 |
TextField2 | MaxLength | 100 |
TextField2 | Required | Yes |
TextField2 | Message | Path for creating the Collection should be specified |
TextField2 | Value | c:\CFusionMX\verity\collections |
TextField3 | Type | Text |
TextField3 | Name | PathToFiles |
TextField3 | Size | 50 |
TextField3 | MaxLength | 50 |
TextField3 | Required | YES |
TextField3 | Message | Please Specify the path of the Files to be Indexed |
TextField4 | Type | Text |
TextField4 | Name | HttpPathToFiles |
TextField4 | Size | 50 |
TextField4 | MaxLength | 50 |
TextField4 | Required | YES |
TextField4 | Message | Please Specify the http path so that links could be provided for the Files in the Search Result |
Set the properties of the List controls as listed in Table 22.6.
Control | Property | Value |
---|---|---|
List1 | Name | FileExtensions |
List1 | Size | 6 |
List1 | Multiple | YES |
List2 | Name | Recursing |
List2 | Size | 1 |
Next, set the options for the List1 control to html, htm, doc, xls, ppt, and pdf. Set the options for the List2 control to Yes and No.
To create a new collection, the Button control is used. Set the properties of the Button control as listed in Table 22.7.
Control | Property | Valuez |
---|---|---|
Button | Type | Submit |
Button | Name | btnSave |
Button | Value | Create and Populate Collections |
The Create Database Collections page is used to create new collections based on databases. The different parameters required to create database collections are provided on this form.
Create a new Web page and name it ManagingDatabaseCollections.cfm. Figure 22.3 displays the design of the Create Database Collections page.
Figure 22.3: The design of the Create Database Collections page.
As shown in Figure 22.3, there's one Form control that acts as a container for the following controls:
An HTML Table control to hold the Text Field and List controls.
Two Text Field controls to accept the details for creating a new collection, such as the name and the path of the collection.
Two List controls to accept the field names to be included in the database collection.
A Button control to create the new collection and populate it by indexing the records to be included.
Table 22.8 lists the properties assigned to the Text Field controls on the page.
Control | Property | Value |
---|---|---|
TextField1 | Type | Text |
TextField1 | Name | CollectionName |
TextField1 | Size | 50 |
TextField1 | MaxLength | 50 |
TextField1 | Required | Yes |
TextField1 | Message | Collection Name is required to create a Collection |
TextField2 | Type | Text |
TextField2 | Name | PathToCollection |
TextField2 | Size | 50 |
TextField2 | MaxLength | 100 |
TextField2 | Required | Yes |
TextField2 | Message | Path for creating the Collection should be specified |
TextField2 | Value | c:\CFusionMX\verity\collections |
Set the properties of the List controls as listed in Table 22.9.
Control | Property | Value |
---|---|---|
List1 | Name | FieldsCollection |
List1 | Size | 4 |
List1 | Multiple | YES |
List2 | Name | FieldsDisplay |
List2 | Size | 3 |
The options for the List1 control are MinutesOfMeeting, Requirements, SalesPerson, and ClientName. The options for the List2 control are ClientName, Salesperson, and InteractionDate.
Set the properties of the Button control as listed in Table 22.10.
Control | Property | Value |
---|---|---|
Button | Type | Submit |
Button | Name | btnSave |
Button | Value | Create and Populate Collections |
The company's sales executives around the world will use the Document Collection Search page to search for the desired information in various document collections created by the administrator.
Create a basic HTML page and save it as SearchInterface.cfm in the ProjectFive directory. As shown in Figure 22.4, the Document Collection Search page consists of various controls in a form container in the page.
Figure 22.4: The design of the Document Collection Search page.
The Document Collection Search page contains the following controls:
An HTML Table control to hold the List controls.
A List control to display and accept the value of the collection selected for the search.
A Text Field control to accept the value for the search criteria.
A Checkbox control to accept input from the user about whether a summary should be included in the search results.
A Button control to accept the search criteria and find the matching documents
Set the properties of the List controls as listed in Table 22.11.
Control | Property | Value |
---|---|---|
List1 | Name | Selected_Collection |
List1 | Size | 4 |
List1 | Multiple | NO |
List1 | Query | get_documents_collections |
List1 | Value | CollectionName |
List1 | Display | Combined |
List1 | Required | YES |
List1 | Message | Select a Collection Description before Clicking the Search Button |
Set the properties of the Text Field control as listed in Table 22.12.
Control | Property | Value |
---|---|---|
TextField1 | Type | Text |
TextField1 | Name | SearchCriteria |
TextField1 | Size | 60 |
TextField1 | Required | Yes |
TextField1 | Message | Give a Search Criteria before Clicking the Search Button |
Set the properties of the Checkbox control as listed in Table 22.13.
Control | Property | Value |
---|---|---|
Checkbox1 | Type | checkbox |
Checkbox1 | Name | ProvideSummary |
Checkbox1 | Value | Yes |
To search the Document Collection Search page for the matching documents, the Button control is used. Set the properties of the Button control as listed in Table 22.14.
Control | Property | Value |
---|---|---|
Button1 | Type | Submit |
Button1 | Name | btnSearch |
Button1 | Value | Search Document Collection |
The Document Collection page also contains a link the user can click to navigate to the Database Collection Search page.
The Document Collection Search Results page is used to display the results of the document search performed by the users. To create the Document Collection Search Results page, create a new Web page and save it as DoSearch.cfm. Figure 22.5 displays the design of the Document Collection Search Results page.
Figure 22.5: The design of the Document Collection Search Results page.
As shown in Figure 22.5, most of the content for the Document Collection Search Results page is generated dynamically and displayed in an HTML table. The links for performing more searches are placed at the bottom of the page. The code for this Web page is discussed in "The Workings of the Worldwide Search Application."
The Database Collection Search page is used to search for the desired information in various database collections created by the administrator.
Create a basic HTML page and save it as DatabaseSearchInterface.cfm in the ProjectFive directory. The design of the page is shown in Figure 22.6.
Figure 22.6: The design of the Database Collection Search page.
The Database Collection Search page contains the following controls:
An HTML Table control to hold the List controls.
A List control to display and accept the value of the selected database collection for the search.
A Text Field control to accept the value for the search criteria.
A Checkbox control to accept whether or not the summary should be included in the search results.
A Button control to accept the search criteria and find the matching records from the database collection.
Set the properties of the List control as described in Table 22.15.
Control | Property | Value |
---|---|---|
List1 | Name | Selected_Collection |
List1 | Size | 4 |
List1 | Multiple | NO |
List1 | Query | get_database_collections |
List1 | Value | CollectionName |
List1 | Display | Combined |
List1 | Required | YES |
List1 | Message | Select a Collection Description before Clicking the Search Button |
Set the properties of the Text Field control as described in Table 22.16.
Control | Property | Value |
---|---|---|
TextField1 | Type | Text |
TextField1 | Name | SearchCriteria |
TextField1 | Size | 60 |
TextField1 | Required | Yes |
TextField1 | Message | Give a Search Criteria before Clicking the Search Button |
Set the properties of the Checkbox control as listed in Table 22.17.
Control | Property | Value |
---|---|---|
Checkboxl | Type | checkbox |
Checkboxl | Name | ProvideSummary |
Checkboxl | Value | Yes |
Next, set the properties of the Button control as listed in Table 22.18.
Control | Property | Value |
---|---|---|
Button | Type | Submit |
Button | Name | btnSearch |
Button | Value | Search Database Collection |
Users can click the link on this form to navigate to the Document Collection Search page.
The Database Collection Search Results page is used to display the results of the database search. To create the Database Collection Search Results page, create a new Web page named DoDatabaseSearch.cfm. Figure 22.7 displays the design of the Database Collection Search Results page.
Figure 22.7: The design of the Database Collection Search Results page.
As shown in Figure 22.7, most of the content for the Database Collection Search Results page is generated dynamically and displayed in an HTML table. The links to perform more searches are placed at the bottom of the page. The code for this Web page is discussed later in "The Workings of the Worldwide Search Application."
In the Search Results page, a field is displayed as a hyperlink. The user can click the hyperlink to view the detailed record for the selected interaction ID. To create the Sales Interaction Detailed View page, create a new Web page and save it as ShowInteraction.cfm. Figure 22.8 displays the design of the Sales Interaction Detailed View page.
Figure 22.8: The design of the Sales Interaction Detailed View page.
As shown in Figure 22.8, most of the content for the Sales Interaction Detailed View page is generated dynamically and displayed in an HTML table. The code for this Web page that explains the dynamic content generation is discussed in "The Workings of the Worldwide Search Application."
|