The Workings of the Worldwide Search Application


The worldwide search application allows users to search the collections created by the administrator. Users can perform searches on document-based collections and database-based collections. A user can view a detailed interaction record from the database-based search results, which provide an option for opening a document on the Web server or downloading it. The worldwide search application has two different interfaces, one for sales executives to perform searches and the other for the administrator to create and manage the collections on which searches are performed.

First, the administrator creates the InfoTools data source using the ColdFusion MX Administrator page. The steps for creating data sources were discussed in Chapter 13, "Creating the Knowledge Bank Application."

When the administrator loads the application using the administrator URL, the Managing Collections page is displayed, as shown in Figure 22.9.

click to expand
Figure 22.9: The Managing Collections page.

The Managing Collections page provides an interface to work with document-based and database-based collections. The page is divided into two forms. The form on the top provides the options to work with database-based collections. The user can select the collection to work with from the list of collections provided. This list only shows database-based collections. The following code from the file, ManagingCollections.cfm, shows how the List control is populated with a description of the database collections:

 <CFQUERY NAME="get_database_collections" DATASOURCE="InfoTools">     SELECT *, (CollectionName + ':   ' + CollectionDesc) AS Combined            FROM SearchCollections     WHERE CollectionType = 'Database' </CFQUERY> 

The <CFQUERY> tag is used to create a database query to fetch the name and description of the collection from the SearchCollections table in the InfoTools database. This query is then used as a source for the Selected_Collection List control. The user selects one collection from this list and can perform three actions on it. The collection can be refreshed, it can be updated, or a specific entry can be removed from the collection and the database table. There are three buttons near the bottom of the form that call the ProcessCollections.cfm file, which is set as the value of the ACTION attribute in the form One. The following code from ProcessCollections.cfm shows how different actions are performed on the selected database collection:

 <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Managing the Collections for Search Application</U></B></DIV> <CFIF #Form.btnSave# is "Refresh Collection" OR        #Form.btnSave# is "Update Collection">     <CFQUERY NAME="get_selected_collection" DATASOURCE="InfoTools">        SELECT * FROM SearchCollections        WHERE CollectionName = '#Form.Selected_Collection#'      </CFQUERY>      <CFQUERY NAME="SalesInteractionInfo" DATASOURCE = "InfoTools">          SELECT InteractionID,ClientName,InteractionDate,SalesPerson,                 MinutesOfMeeting,Requirements from SalesInteractions      </CFQUERY>      <CFIF #Form.btnSave# is "Refresh Collection">          <CFSET varAction = "Refresh">      <CFELSE>      <CFSET varAction = "Update"> </CFIF>      <CFOUTPUT QUERY = "get_selected_collection">      <CFLOCK TYPE = "EXCLUSIVE" TIMEOUT="30">      <CFINDEX COLLECTION=#Form.Selected_Collection#          TYPE = "Custom"          ACTION = #varAction#          KEY = "InteractionID"          TITLE = #Title#          BODY = #Body#          QUERY = "SalesInteractionInfo">      </CFLOCK>      </CFOUTPUT>      <CFOUTPUT>      <CFIF #Form.btnSave# is "Refresh Collection">           <P >Collection <U>#Form.Selected_Collection#</U>                 is Successfully Refreshed</P>      <CFELSE>          <P >Collection <U>#Form.Selected_Collection#</U>                 is Successfully Updated</P>     </CFIF>     </CFOUTPUT> <CFELSE>     <CFIF #Form.InteractionID# LTE 0>         <CFOUTPUT><P >Interaction ID is Required to Remove               Specific Record from the Collection</P></CFOUTPUT>         <CFABORT>     <CFELSE>         <CFQUERY NAME="DeleteSpecific" DATASOURCE="InfoTools">             DELETE FROM SalesInteractions WHERE InteractionID =                      #Form.InteractionID#         </CFQUERY>         <CFLOCK NAME = "DELETE_INDEX" TYPE = "EXCLUSIVE" TIMEOUT = "30">             <CFINDEX              COLLECTION = #Form.Selected_Collection#              ACTION = "Delete"              Key = "#Form.InteractionID#">         </CFLOCK>         <CFOUTPUT>         <P >Record for Interaction ID              <U>#Form.InteractionID#</U> from Collection              <U>#Form.Selected_Collection#</U> is Successfully Deleted</P>         </CFOUTPUT>     </CFIF> </CFIF> </body> </html> 

The code in this file checks the value of Form.btnSave. This value corresponds to the button clicked on the Managing Collections page. If this value is Refresh Collection or Update Collection, the steps performed are the same. In the first step, all the information stored about the selected collection is extracted from the SearchCollections table in the InfoTools database. This information is used in the <CFINDEX> tag to perform the refresh or update action. The query used for these actions is SalesInteractionInfo. The variable varAction is set to Refresh or Update depending upon the button clicked. The <CFINDEX> tag is used to refresh or update the selected collection.

If the Delete Collection button is clicked, the code checks if the interaction ID has been provided. If the interaction ID isn't provided, an error message is displayed to the user. If the interaction ID is provided, the <CFQUERY> tag is used to delete the specified record from the SalesInteraction table in the InfoTools database. The <CFINDEX> tag with the delete action is used to remove the entry from the selected collection. After all the specified entries are removed, the selected collection should be refreshed.

The form at the bottom provides the options to work with document-based collections. The user can select the collection to work with from the list of collections provided. This list only shows document-based collections. The following code from ManagingCollections.cfm shows how the List control is populated with a description of the document collections:

 <CFQUERY NAME="get_documents_collections" DATASOURCE="InfoTools">     SELECT *,(CollectionName + ': ' + CollectionDesc) AS Combined     FROM SearchCollections     WHERE CollectionType = 'Documents' </CFQUERY> 

This query is used as the source for the Selected_Collection List control. The user selects one collection from this list and can optimize, repair, or delete it. The following code from ProcessDocCollections.cfm shows how different actions are performed on the selected document collection:

 <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:       Admin Interface</U></B><BR> <B><U>Managing the Collections for Search Application</U></B></DIV> <CFIF #Form.btnSave# is "Optimize Collection">     <CFSET varAction = "Optimize"> <CFELSEIF #Form.btnSave# is "Repair Collection">     <CFSET varAction = "Repair"> <CFELSE>     <CFSET varAction = "Delete"> </CFIF> <CFLOCK TYPE = "EXCLUSIVE" TIMEOUT="30"> <CFCOLLECTION ACTION = #varAction#               COLLECTION=#Form.Selected_Collection#> </CFLOCK> <CFIF #Form.btnSave# is "Delete Collection">     <CFQUERY NAME="DeleteCollection" DATASOURCE="InfoTools">              DELETE FROM SearchCollections WHERE CollectionName =                       '#Form.Selected_Collection#'     </CFQUERY> </CFIF> <CFOUTPUT> <CFIF #Form.btnSave# is "Optimize Collection">     <P >Collection <U>#Form.Selected_Collection#</U>           is Successfully Optimized</P> <CFELSEIF #Form.btnSave# is "Repair Collection">     <P >Collection <U>#Form.Selected_Collection#</U>     is Successfully Repaired</P> <CFELSE>     <P >Collection <U>#Form.Selected_Collection#</U>     is Successfully Deleted</P> </CFIF> </CFOUTPUT> </body> </html> 

The code in this file checks the value of Form.btnSave. This value corresponds to the button clicked on the Managing Collections page. If this value is Optimize Collection, the varAction variable is set to Optimize. It's set to Repair if the Repair Collection button is clicked, and it's set to Delete when the Delete Collection button is clicked. The <CFCOLLECTION> tag is used to perform the desired action. If Delete is chosen, the corresponding collection record is deleted from the SearchCollections table in the InfoTools database. A relevant message is displayed to the user after the successful completion of the selected action.

Creating Database Collections

There's a Create New Database Collection link on the Managing Collections page. When the administrator clicks this link, the ManagingDatabaseCollections.cfm file is loaded and the Creating Database Collections page is displayed. The administrator uses this page to create new database collections. The administrator should provide details such as the collection name and the path where the collection is stored. The collection can be created in the SalesInteraction table in the InfoTools database. The administrator can decide to use multiple searchable fields from the SalesInteraction table in a collection. The field that displays the search results when the user performs a search on a database collection can be specified when the collection is created. This field is selected as the display field. The names of the applicable fields from the SalesInteraction table are provided in the List controls. After providing all the details, the administrator clicks the Create and Populate Collections button. This executes the file CreateDatabaseCollection.cfm, specified in the ACTION attribute. The following code in the CreateDatabaseCollection.cfm file creates a new collection and saves a record for the new collection in the SearchCollections table:

 <CFQUERY NAME="SalesInteractionInfo" DATASOURCE = "InfoTools">     SELECT InteractionID,ClientName,InteractionDate,SalesPerson,        MinutesOfMeeting,Requirements from SalesInteractions </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Creating Database Based Collections</U></B></DIV> <HR> <CFSET varFields="InteractionDate"> <CFSET Length = ListLen(#Form.FieldsCollection#)> <CFLOOP INDEX = "element" FROM = "1" TO="#Length#">     <CFSET varFields = varFields & ", " &         ListGetAt(#Form.FieldsCollection#,element)> </CFLOOP> <CFLOCK NAME="Create_doc_col_lock" TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFCOLLECTION ACTION = "create"         COLLECTION=#Form.CollectionName#         PATH=#Form.PathToCollection#          LANGUAGE = "English"> </CFLOCK> <CFLOCK TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFINDEX COLLECTION=#Form.CollectionName#         TYPE = "Custom"         ACTION = "Update"         KEY = "InteractionID"         TITLE = #Form.FieldsDisplay#         BODY = #varFields# QUERY = "SalesInteractionInfo"> </CFLOCK> <CFSET varColDesc = "This is a Collection based on fields " & #varFields#> <CFQUERY NAME="InsertCollection" DATASOURCE = "InfoTools">     INSERT into SearchCollections     (CollectionName,CollectionType, CollectionDesc,TypeOfCol,Title,Body)     VALUES ('#Form.CollectionName#','Database','#varColDesc#','Custom',        '#Form.FieldsDisplay#','#varFields#') </CFQUERY> <DIV align="center" >Specified Database Collection     has been created Successfully.</DIV> <HR> <a href ="ManagingDatabaseCollections.cfm"><B> Back to Creating Database Collections</B></a><BR> </body> </html> 

In this code, the multiple searchable fields are stored in the varFields variable. This variable is used by the BODY attribute of <CFINDEX> tag while populating the collection. The ACTION attribute of the <CFINDEX> tag is set to Update. This setting adds all the new records specified by the SalesInteractionInfo query to the collection. Before using the <CFINDEX> tag, the <CFCOLLECTION> tag is used to create a collection at the specified path with the name provided in the form. After the collection is created, a record is inserted into the SearchCollections table in the InfoTools database. The different attributes specified in the <CFINDEX> tag, such as TITLE and BODY, are saved in the database record. A message is displayed to the user stating that the collection has been created successfully.

Creating Documents Collections

When the administrator clicks the Create New Document Collection link on the Managing Collections page, the ManagingDocCollections.cfm file is loaded and the Creating Documents Collections page is displayed. The administrator uses this page to create new document collections. The administrator should provide details like collection name, the path where the collection is stored, the path for the files to be indexed and put in the collection, and the HTTP path, which is appended before the filenames in the search results so that users can access the files by using the hyperlink. The administrator should also provide the file extensions, which are used for the new collection. In this way, the administrator can create different collections for proposals, presentations, and technical specification documents. The files in the specified directory are picked for creating the collection. The RECURSE attribute in the <CFINDEX> tag, if set to Yes, can also include the subdirectories in that directory for creating the new collection. After providing all the details, the administrator clicks the Create and Populate Collections button. The file CreateDocCollection.cfm specified in the ACTION attribute is executed. The following code in the CreateDocCollection.cfm file creates a new collection and saves a record for the new collection in the SearchCollections table:

 <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Creating Documents Based Collections</U></B></DIV> <HR> <CFLOCK NAME="Create_doc_col_lock" TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFCOLLECTION ACTION = "create"         COLLECTION=#Form.CollectionName#         PATH=#Form.PathToCollection#         LANGUAGE = "English"> </CFLOCK> <CFSET varFileExt=".txt"> <CFSET Length = ListLen(#Form.FileExtensions#)> <CFLOOP INDEX = "element" FROM = "1" TO="#Length#">     <CFSET varFileExt = varFileExt & ", ." &        ListGetAt(#Form.FileExtensions#,element)> </CFLOOP> <CFLOCK NAME="Create_doc_index_lock" TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFINDEX COLLECTION=#Form.CollectionName# TYPE = "Path" ACTION = "update"         KEY =#Form.PathToFiles# URLPATH =#Form.HttpPathToFiles#         EXTENSIONS = #varFileExt# RECURSE = #Form.Recursing#> </CFLOCK> <CFSET varColDesc = "This is a Collection based on File Extensions "        & #varFileExt#> <CFQUERY NAME="InsertCollection" DATASOURCE = "InfoTools">     INSERT into SearchCollections     (CollectionName,CollectionType,        CollectionDesc,TypeOfCol,URLPath,Extensions)     VALUES ('#Form.CollectionName#','Documents','#varColDesc#',        'Path','#Form.HttpPathToFiles#','#varFileExt#') </CFQUERY> <DIV align="center" >Specified Documents Collection         has been created Successfully.</DIV> <HR> <a href ="ManagingDocCollections.cfm"><B>Back to Creating            Documents Collections</B></a><BR> </body> </html> 

In this code, the multiple file extensions are stored in the varFileExt variable. This variable is used by the EXTENSIONS attribute of the <CFINDEX> tag while populating the collection. The ACTION attribute of the <CFINDEX> tag is set to Update. This setting will add all the new documents that are valid and available in the given path to the collection. After the collection is created, a record is inserted in the SearchCollections table. The different attributes specified in the <CFINDEX> tag, like EXTENSIONS and RECURSE, are saved in the database record. A message is given to the user stating that the collection has been created successfully.

Searching the Document Collections in the Worldwide Search Application

The Document Collection Search page is used to search the documents-based collections based on the criteria specified by a user. Users can navigate to the Document Collection Search page by using the URL provided to them by the administrator. When the user specifies the given URL in the browser, the SearchInterface.cfm file is loaded and displays the page to specify the search criteria. The user must select a collection in which the search is to be performed. The search criteria needs to be provided in the text box given on this page. The user also has to specify if a summary should be displayed with each record in the search result. If a collection or a search criterion isn't specified, there's a warning message that these fields are required and the search process cannot proceed without this input. After the collection and the criteria are specified, the user clicks the Search Document Collection button to display the search results on a new page. The DoSearch.cfm file generates this page dynamically.

The DoSearch.cfm file uses the <CFSEARCH> tag to perform a search on the specified collection. This code from the DoSearch.cfm file shows how the search results are generated:

 <CFSEARCH COLLECTION = #Form.Selected_Collection# NAME = "PerformSearch"            TYPE = "Simple" CRITERIA = "#Form.SearchCriteria#"> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Search Interface</U></B><BR> <B><U>Search Results from the Documents Collection</U></B><BR></DIV> <CFOUTPUT> <P >The Search for: #Form.SearchCriteria# was performed        on #PerformSearch.RecordsSearched# and #PerformSearch.RecordCount#        matching records were found.</P> </CFOUTPUT> <CFIF PerformSearch.RecordCount EQ 0>     <CFOUTPUT>     <P >No matching Documents were Found in the Specified Collection.</P>     </CFOUTPUT> <CFELSE>   <TABLE BORDER =0 cellpadding="4" cellspacing="4">     <TR>       <TD width="90%"><B>Document Title</B></TD>       <TD width = "10%"><B>Score</B></TD>     </TR>     <TR>       <TD COLSPAN = 2><HR></TD>     </TR>     <CFOUTPUT QUERY = "PerformSearch">     <TR>       <TD><A HREF ="#PerformSearch.URL#">         <CFIF PerformSearch.Title IS "">            <B>Untitled</B>         <CFELSE>            <B>#Title#</B>         </CFIF>          </A>       </TD>       <TD><B><CFIF PerformSearch.Score IS NOT "">               #Evaluate(PerformSearch.Score * 100)# %             </CFIF></B></TD>     </TR>     <CFIF IsDefined('Form.ProvideSummary')>     <TR>       <TD><P Align="justify" >#Summary#</TD>       <TD>&nbsp;</TD>     </TR>     </CFIF>     </CFOUTPUT>     <TR>       <TD COLSPAN = "2"><HR></TD>     </TR>   </TABLE> </CFIF> </body> </html> 

The <CFSEARCH> tag uses its NAME attribute to refer to the search results. The criteria given by the user is set as the value for the CRITERIA attribute in the <CFSEARCH> tag. The output of the search is available in the form of a query. The <CFOUTPUT> tag is used to display the search results. The QUERY attribute in the <CFOUTPUT> tag is set to the NAME of the search used in the <CFSEARCH> tag. The output query has two fields, TITLE and SCORE, to display the search results. Title shows the title of the document, while Score shows the percentage match based on the criteria specified. The search displays the results in a tabular format. If the search summary is also to be included, the search results for each record include the summary field from the output query. The Title column in the search result is displayed as a hyperlink. The user can open or download the document displayed in the search results.

Searching the Database Collections in the Worldwide Search Application

The Database Collection Search page is used to search the database-based collections based on the criteria specified by a user. Users can navigate to the Database Collection Search page by using the URL provided to them by the administrator. When the user specifies the given URL in the browser, the DatabaseSearchInterface.cfm file is loaded and displays the page to specify the search criteria. The user should select a collection to perform the search. The search criteria must be provided in the text box given in this page. The user should also specify if a summary should be displayed with each record in the search result. If a collection or the search criteria are not given, a warning message is displayed to the user stating that these fields are required fields and the search process cannot proceed without this input. After the collection and the criteria are specified, the user clicks the Search Database Collection button to display the search results on a new page. The DoDatabaseSearch.cfm file generates this page dynamically.

The DoDatabaseSearch.cfm file uses the <CFSEARCH> tag to perform a search on the specified collection. The following code from the DoDatabaseSearch.cfm file shows how the search results are generated:

 <CFSEARCH COLLECTION = #Form.Selected_Collection# NAME = "PerformSearch"     TYPE = "Simple" CRITERIA = "#Form.SearchCriteria#"> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Search Interface</U></B><BR> <B><U>Search Results from the Database Collection</U></B><BR></DIV> <CFOUTPUT> <P >The Search for: #Form.SearchCriteria#         was performed on #PerformSearch.RecordsSearched#         records and#PerformSearch.RecordCount# matching records were found.</P> </CFOUTPUT> <CFIF PerformSearch.RecordCount EQ 0>     <CFOUTPUT>     <P >No matching Records were Found in the Specified     Collection.</P>     </CFOUTPUT> <CFELSE>    <TABLE BORDER =0 cellpadding="4" cellspacing="4">      <TR>        <TD width="90%"><B>Client Name</B></TD>        <TD width = "10%"><B>Score</B></TD>     </TR>     <TR>       <TD COLSPAN = 2><HR></TD>     </TR>     <CFOUTPUT QUERY = "PerformSearch">     <TR>       <TD><A HREF ="ShowInteraction.cfm?ID=#Key#"><B>#Title#</B>            </A></TD>       <TD><B><CFIF PerformSearch.Score IS NOT "">              #Evaluate(PerformSearch.Score * 100)# %              </CFIF></B></TD>     </TR>        <CFIF IsDefined('Form.ProvideSummary')>     <TR>       <TD><P Align="justify" >#Summary#</TD>       <TD>&nbsp;</TD>     </TR>         </CFIF>         </CFOUTPUT>     <TR>       <TD COLSPAN = "2"><HR></TD>     </TR>   </TABLE> </CFIF> </body> </html> 

The Title column in the search result is displayed as a hyperlink. The user can view the detailed interaction record by clicking the record from the SalesInteractions table because it's displayed in the search results. The hyperlink activates the file ShowInteraction.cfm, with the interaction ID passed as a parameter to this file. This interaction ID is used in the ShowInteraction.cfm file to display the detailed interaction record. The following code from the ShowInteraction.cfm file below shows how the details are extracted from the SalesInteractions table in the InfoTools database. The <CFQUERY> tag is used to extract the specific record from the SalesInteractions table. The WHERE clause contains the interaction ID, which is passed to the ShowInteraction.cfm file:

 <CFQUERY NAME="SelectSpecific" DATASOURCE="InfoTools">     SELECT * FROM SalesInteractions WHERE InteractionID = #URL.ID# </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Search Interface</U></B><BR> <B><U>View Interaction Details</U></B></DIV> <BR> <CFOUTPUT QUERY = "SelectSpecific"> <TABLE BORDER=0 cellpadding="4" cellspacing="4" > <TR>     <TD><B>Interaction ID:</B></TD>     <TD>#InteractionID#</TD> </TR> <TR>     <TD><B>Interaction Date:</B></TD>     <TD>#InteractionDate#</TD> </TR> <TR>     <TD><B>Client Name:</B></TD>     <TD>#ClientName#</TD> </TR> <TR>     <TD><B>Sales Person:</B></TD>     <TD>#SalesPerson#</TD> </TR> <TR>     <TD><B>Minutes Of the Meeting:</B></TD>     <TD>#MinutesOfMeeting#</TD> </TR> <TR>     <TD><B>Client's Requirements:</B></TD>     <TD>#Requirements#</TD> </TR> </TABLE> </CFOUTPUT> </body> </html> 

Now that you understand the code for all the Web pages, I'll provide the entire listing of the code for all of them. Listing 22.1 provides the complete code for the ManagingCollections.cfm page.

Listing 22.1: ManagingCollections.cfm

start example
 <CFQUERY NAME="get_database_collections" DATASOURCE="InfoTools">     SELECT *, (CollectionName + ': ' + CollectionDesc) AS Combined     FROM SearchCollections     WHERE CollectionType = 'Database' </CFQUERY> <CFQUERY NAME="get_documents_collections" DATASOURCE="InfoTools">     SELECT *,(CollectionName + ': ' + CollectionDesc) AS Combined     FROM SearchCollections     WHERE CollectionType = 'Documents' </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Managing the Collections for Search Application</U></B></DIV> <BR><B><U>Working with Database Collections:</U></B> <cfform Name= "One" ACTION="ProcessCollections.cfm" METHOD="POST">     <TABLE>         <TR>             <TD><B>* Select a Collection Name:</B></TD>             <TD><CFSELECT Name = "Selected_Collection" Size = "4"                     QUERY="get_database_collections" Value="CollectionName"                     DISPLAY="Combined" REQUIRED="YES" MESSAGE="Select a                     Collection Description before Clicking the Action                     Buttons."></CFSELECT></TD>         </TR>         <TR>             <TD><B>Interaction Id (required for Remove Entry                       option):</B></TD>             <TD><cfinput TYPE="Text" NAME="InteractionID" SIZE="10"                       MAXLENGTH="3" validate="integer" message="Interaction ID                       Should be Numeric"></TD>         </TR>     </TABLE> <INPUT TYPE="Submit" NAME="btnSave" VALUE="Refresh Collection"> <INPUT TYPE="Submit" NAME="btnSave" VALUE="Update Collection">   <INPUT TYPE="Submit" NAME="btnSave" VALUE="Remove Specific Entry">   <a href ="ManagingDatabaseCollections.cfm"><B>Create New Database   Collection</B></a><BR> </cfform> <B><U>Working with Document Collections:</U></B> <cfform Name = "Two" ACTION="ProcessDocCollections.cfm" METHOD="POST">     <TABLE>         <TR>             <TD><B>* Select a Collection Name:</B></TD>             <TD><CFSELECT Name = "Selected_Collection" Size = "4"                       QUERY="get_documents_collections" Value="CollectionName"                       DISPLAY="Combined" REQUIRED="YES" MESSAGE="Select a                       Collection Description before Clicking the Action                       Buttons."></CFSELECT></TD>         </TR>     </TABLE>     <INPUT TYPE="Submit" NAME="btnSave" VALUE="Optimize Collection">     <INPUT TYPE="Submit" NAME="btnSave" VALUE="Repair Collection">     <INPUT TYPE="Submit" NAME="btnSave" VALUE="Delete Collection">     <a href ="ManagingDocCollections.cfm"><B>Create New Document      Collection</B></a><BR> </cfform> </body> </html> 
end example

The complete code for the ManagingDatabaseCollections.cfm page is found in Listing 22.2.

Listing 22.2: ManagingDatabaseCollections.cfm

start example
 <HTML> <HEAD> <TITLE>Info Tools Search Application</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </HEAD> <BODY> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Creating Database Based Collections</U></B></DIV> <HR> <B><U>Provide Details for Creating a New Collection:</U></B> <cfform ACTION="CreateDatabaseCollection.cfm" METHOD="POST"> <TABLE>     <TR>       <TD><B>* Collection Name:</B></TD>         <TD><cfinput TYPE="Text" NAME="CollectionName" SIZE="50"               MAXLENGTH="10" REQUIRED="YES" MESSAGE="Collection Name is required               to create a Collection"></TD>     </TR>     <TR>         <TD><B>* Path to the Collection:</B></TD>         <TD><cfinput TYPE="Text" NAME="PathToCollection" VALUE               ="c:\CFusionMX\verity\collections" SIZE="50" MAXLENGTH="10"               REQUIRED="YES" MESSAGE="Path for creating the Collection should be               specified"></TD>     </TR>     <TR>          <TD><B>* Select Fields for Collection: </B></TD>          <TD><SELECT Name="FieldsCollection" Size="4" MULTIPLE="YES">              <OPTION>MinutesOfMeeting</OPTION>              <OPTION>Requirements</OPTION>              <OPTION>SalesPerson</OPTION>              <OPTION>ClientName</OPTION></SELECT></TD>     </TR>     <TR>          <TD><B>* Select Display Field: </B></TD>          <TD><SELECT Name="FieldsDisplay" Size="3">              <OPTION>ClientName</OPTION>              <OPTION>SalesPerson</OPTION>              <OPTION>InteractionDate</OPTION></SELECT></TD>     </TR> </TABLE> <BR> <INPUT TYPE="Submit" NAME="btnSave" VALUE="Create and Populate Collections"><BR> </cfform> <HR> <a href ="ManagingCollections.cfm"><B>Back to Managing Collections</B></a><BR> </BODY> </HTML> 
end example

Listing 22.3 provides the complete code for the ManagingDocCollections.cfm page.

Listing 22.3: ManagingDocCollections.cfm

start example
 <HTML> <HEAD> <TITLE>Info Tools Search Application</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </HEAD> <BODY> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Creating Documents Based Collections</U></B></DIV> <HR> <B><U>Provide Details for Creating a New Collection:</U></B> <cfform ACTION="CreateDocCollection.cfm" METHOD="POST">   <TABLE>     <TR>       <TD><B>* Collection Name:</B></TD>         <TD><cfinput TYPE="Text" NAME="CollectionName" SIZE="50"                MAXLENGTH="50" REQUIRED="YES" MESSAGE="Collection Name is required                to create a Collection"></TD>     </TR>     <TR>         <TD><B>* Path to the Collection:</B></TD>         <TD><cfinput TYPE="Text" NAME="PathToCollection" VALUE                ="c:\CFusionMX\verity\collections" SIZE="50" MAXLENGTH="10"                REQUIRED="YES" MESSAGE="Path for creating the Collection should be                specified"></TD>     </TR>     <TR>         <TD><B>* Path to the Files: </B></TD>         <TD><cfinput TYPE="Text" NAME="PathToFiles" SIZE="50"                MAXLENGTH="50" REQUIRED="YES" MESSAGE="Please Specify the path of                the Files to be Indexed."></TD>     </TR>     <TR>         <TD><B>* Http Path For Search Results Links: </B></TD>         <TD><cfinput TYPE="Text" NAME="HttpPathToFiles" SIZE="50"                MAXLENGTH="50" REQUIRED="YES" MESSAGE="Please Specify the http                path so that link could be provided for the Files in the Search                Result."></TD>     </TR>     <TR>         <TD><B>* File Extensions to be Used: </B></TD>         <TD><SELECT Name="FileExtensions" Size="6" MULTIPLE="YES">             <OPTION>html</OPTION>             <OPTION>htm</OPTION>             <OPTION>doc</OPTION>             <OPTION>xlS</OPTION>             <OPTION>ppt</OPTION>             <OPTION>pdf</OPTION></SELECT></TD>     </TR>     <TR>         <TD><B>* Include SubDirectories: </B></TD>         <TD><SELECT Name="Recursing" Size="1">             <OPTION>Yes</OPTION>             <OPTION>No</OPTION></SELECT></TD>     </TR> </TABLE> <BR> <INPUT TYPE="Submit" NAME="btnSave" VALUE="Create and Populate Collections"><BR> </cfform> <HR> <a href ="ManagingCollections.cfm"><B>Back to Managing Collections</B></a><BR> </BODY> </HTML> 
end example

Listing 22.4 provides the complete code for the CreateDatabaseCollection.cfm page.

Listing 22.4: CreateDatabaseCollection.cfm

start example
 <CFQUERY NAME="SalesInteractionInfo" DATASOURCE = "InfoTools">     SELECT InteractionID,ClientName,InteractionDate,SalesPerson,        MinutesOfMeeting,Requirements from SalesInteractions </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Creating Database Based Collections</U></B></DIV> <HR> <CFSET varFields="InteractionDate"> <CFSET Length = ListLen(#Form.FieldsCollection#)> <CFLOOP INDEX = "element" FROM = "1" TO="#Length#">     <CFSET varFields = varFields & ", " &        ListGetAt(#Form.FieldsCollection#,element)> </CFLOOP>      <CFLOCK NAME="Create_doc_col_lock" TYPE = "EXCLUSIVE" TIMEOUT="30">          <CFCOLLECTION ACTION = "create"              COLLECTION=#Form.CollectionName#              PATH=#Form.PathToCollection#              LANGUAGE = "English"> </CFLOCK> <CFLOCK TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFINDEX COLLECTION=#Form.CollectionName#         TYPE = "Custom"         ACTION = "Update"         KEY = "InteractionID"         TITLE = #Form.FieldsDisplay#         BODY = #varFields#         QUERY = "SalesInteractionInfo"> </CFLOCK> <CFSET varColDesc = "This is a Collection based on fields " & #varFields#> <CFQUERY NAME="InsertCollection" DATASOURCE = "InfoTools">     INSERT into SearchCollections     (CollectionName,CollectionType, CollectionDesc,TypeOfCol,Title,Body)     VALUES ('#Form.CollectionName#','Database','#varColDesc#','Custom',        '#Form.FieldsDisplay#','#varFields#') </CFQUERY> <DIV align="center" >Specified Database Collection has been created Successfully.</DIV> <HR> <a href ="ManagingDatabaseCollections.cfm"><B>Back to Creating    Database Collections</B></a><BR> </body> </HTML> 
end example

Listing 22.5 provides the complete code for the CreateDocCollection.cfm page.

Listing 22.5: CreateDocCollection.cfm

start example
 <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Admin Interface</U></B><BR> <B><U>Creating Documents Based Collections</U></B></DIV> <HR> <CFLOCK NAME="Create_doc_col_lock" TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFCOLLECTION ACTION = "create"         COLLECTION=#Form.CollectionName#         PATH=#Form.PathToCollection#         LANGUAGE = "English"> </CFLOCK> <CFSET varFileExt=".txt"> <CFSET Length = ListLen(#Form.FileExtensions#)> <CFLOOP INDEX = "element" FROM = "1" TO="#Length#">     <CFSET varFileExt = varFileExt & ", ." &         ListGetAt(#Form.FileExtensions#,element)> </CFLOOP> <CFLOCK NAME="Create_doc_index_lock" TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFINDEX COLLECTION=#Form.CollectionName# TYPE = "Path" ACTION = "update"         KEY =#Form.PathToFiles# URLPATH =#Form.HttpPathToFiles#         EXTENSIONS = #varFileExt# RECURSE = #Form.Recursing#> </CFLOCK> <CFSET varColDesc = "This is a Collection based on File Extensions " & #varFileExt#> <CFQUERY NAME="InsertCollection"  DATASOURCE = "InfoTools">      INSERT into SearchCollections      (CollectionName,CollectionType,         CollectionDesc,TypeOfCol,URLPath,Extensions)      VALUES ('#Form.CollectionName#','Documents','#varColDesc#',         'Path','#Form.HttpPathToFiles#','#varFileExt#') </CFQUERY> <DIV align="center" >Specified Documents Collection      has been created Successfully.</DIV> <HR> <a href ="ManagingDocCollections.cfm"><B>Back to Creating     Documents Collections</B></a><BR> </body> </HTML> 
end example

Listing 22.6 provides the complete code for the SearchInterface.cfm page.

Listing 22.6: SearchInterface.cfm

start example
 <CFQUERY NAME="get_documents_collections" DATASOURCE="InfoTools">     SELECT *,(CollectionName + ': ' + CollectionDesc) AS Combined     FROM SearchCollections WHERE CollectionType = 'Documents' </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Search Interface</U></B><BR> <B><U>Searching the Documents Collection</U></B><BR></DIV> <cfform ACTION="DoSearch.cfm" METHOD="POST"> <TABLE BORDER=0> <TR>     <TD><B>* Select a Collection Name:</B></TD>     <TD><CFSELECT Name = "Selected_Collection" Size = "4"        QUERY="get_documents_collections" Value="CollectionName"        DISPLAY="Combined" REQUIRED="YES" MESSAGE="Select a Collection        Description before Clicking the Search Button."></CFSELECT></TD> </TR> <TR> <TD><B>* Search the Collection For:</B></TD> <TD><cfinput TYPE="text" NAME="SearchCriteria" SIZE="60"               REQUIRED="YES"              MESSAGE="Give a Search Criteria before                       Clicking the Search Button."></TD> </TR> <TR> <TD><B>Provide me the Summary Also:</B></TD> <TD><INPUT TYPE="Checkbox" Name= "ProvideSummary" Value="Yes"></TD> </TR> <TR><TD>&nbsp;</TD> <TD>&nbsp;</TD> </TR> <TR> <TD COLSPAN = "2" Align = "center"> <INPUT TYPE = "Submit" NAME="btnSearch" VALUE="Search Document Collection"> </TD> </TR> <TR> <TD COLSPAN = "2" Align = "left"> <a href ="DatabaseSearchInterface.cfm"><B>Search the Database Collections</B></a> </TD> </TR> </TABLE> </cfform> </body> </html> 
end example

Listing 22.7 provides the complete code for the DatabaseSearchInterface.cfm page.

Listing 22.7: DatabaseSearchInterface.cfm

start example
 <CFQUERY NAME="get_database_collections" DATASOURCE="InfoTools">     SELECT *, (CollectionName + ': ' + CollectionDesc) AS Combined     FROM SearchCollections     WHERE CollectionType = 'Database' </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Search Interface</U></B><BR> <B><U>Searching the Database Collections</U></B><BR></DIV> <cfform ACTION="DoDatabaseSearch.cfm" METHOD="POST"> <TABLE BORDER=0> <TR>     <TD><B>* Select a Collection Name:</B></TD>     <TD><CFSELECT Name = "Selected_Collection" Size = "4"         QUERY="get_database_collections" Value="CollectionName"         DISPLAY="Combined" REQUIRED="YES" MESSAGE="Select a Collection         Description before Clicking the Search Button."></CFSELECT></TD> </TR> <TR> <TD><B>* Search the Collection For:</B></TD> <TD><cfinput TYPE="text" NAME="SearchCriteria" SIZE="60"               REQUIRED="YES"               MESSAGE="Give a Search Criteria before               Clicking the Search Button."></TD> </TR> <TR> <TD><B>Provide me the Summary Also:</B></TD> <TD><INPUT TYPE="Checkbox" Name= "ProvideSummary" Value="Yes"></TD> </TR> <TR><TD>&nbsp;</TD> <TD>&nbsp;</TD> </TR> <TR> <TD COLSPAN = "2" Align = "center"> <INPUT TYPE = "Submit" NAME="btnSearch" VALUE="Search Database Collection"> </TD> </TR> <TR> <TD COLSPAN = "2" Align = "left"> <a href ="SearchInterface.cfm"><B>Search the Documents Collections</B></a> </TD> </TR> </TABLE> </cfform> </body> </HTML> 
end example

Listing 22.8 provides the complete code for the DoSearch.cfm page.

Listing 22.8: DoSearch.cfm

start example
 <CFSEARCH COLLECTION = #Form.Selected_Collection# NAME = "PerformSearch"     TYPE = "Simple" CRITERIA = "#Form.SearchCriteria#"> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:      Search Interface</U></B><BR> <B><U>Search Results from the Documents Collection</U></B><BR></DIV> <CFOUTPUT> <P >The Search for: #Form.SearchCriteria#                    was performed on #PerformSearch.RecordsSearched# and                    #PerformSearch.RecordCount# matching records were found. </P> </CFOUTPUT> <CFIF PerformSearch.RecordCount EQ 0>     <CFOUTPUT>     <P >No matching Documents were Found in the Specified        Collection.</P>     </CFOUTPUT> <CFELSE>   <TABLE BORDER =0 cellpadding="4" cellspacing="4">     <TR>              <TD width="90%"><B>Document Title</B></TD>              <TD width = "10%"><B>Score</B></TD>          </TR>          <TR>              <TD COLSPAN = 2><HR></TD>          </TR>          <CFOUTPUT QUERY = "PerformSearch">          <TR>              <TD><A HREF ="#PerformSearch.URL#">              <CFIF PerformSearch.Title IS "">                  <B>Untitled</B>              <CFELSE>                  <B>#Title#</B>              </CFIF>              </A></TD>              <TD><B><CFIF PerformSearch.Score IS NOT "">              #Evaluate(PerformSearch.Score * 100)# %              </CFIF></B></TD>          </TR>          <CFIF IsDefined('Form.ProvideSummary')>          <TR>              <TD><P Align="justify" >#Summary#</TD>              <TD>&nbsp;</TD>          </TR>          </CFIF>          </CFOUTPUT>          <TR>              <TD COLSPAN = "2"><HR></TD>         </TR>     </TABLE> </CFIF> </body> </HTML> 
end example

Listing 22.9 provides the complete code for the DoDatabaseSearch.cfm page.

Listing 22.9: DoDatabaseSearch.cfm

start example
 <CFSEARCH COLLECTION = #Form.Selected_Collection# NAME = "PerformSearch"     TYPE = "Simple" CRITERIA = "#Form.SearchCriteria#"> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application: Search Interface</U></B><BR> <B><U>Search Results from the Database Collection</U></B><BR></DIV> <CFOUTPUT> <P >The Search for: #Form.SearchCriteria# was performed on #PerformSearch.RecordsSearched# records and #PerformSearch.RecordCount# matching records were found.</P> </CFOUTPUT> <CFIF PerformSearch.RecordCount EQ 0>     <CFOUTPUT>     <P >No matching Records were Found in the Specified        Collection.</P>     </CFOUTPUT> <CFELSE>    <TABLE BORDER =0 cellpadding="4" cellspacing="4">      <TR>              <TD width="90%"><B>Client Name</B></TD>              <TD width = "10%"><B>Score</B></TD>           </TR>           <TR>              <TD COLSPAN = 2><HR></TD>           </TR>           <CFOUTPUT QUERY = "PerformSearch">           <TR>               <TD><A HREF                        ="ShowInteraction.cfm?ID=#Key#"><B>#Title#</B></A></TD>               <TD><B><CFIF PerformSearch.Score IS NOT "">               #Evaluate(PerformSearch.Score * 100)# %               </CFIF></B></TD>           </TR>           <CFIF IsDefined('Form.ProvideSummary')>           <TR>               <TD><P Align="justify" >#Summary#</TD>               <TD>&nbsp;</TD>           </TR>           </CFIF>           </CFOUTPUT>           <TR>               <TD COLSPAN = "2"><HR></TD>           </TR>      </TABLE> </CFIF> </body> </HTML> 
end example

Listing 22.10 provides the complete code for the ProcessCollections.cfm page.

Listing 22.10: ProcessCollections.cfm

start example
 <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:     Admin Interface</U></B><BR> <B><U>Managing the Collections for Search Application</U></B></DIV> <CFIF #Form.btnSave# is "Refresh Collection" OR #Form.btnSave#      is "Update Collection">     <CFQUERY NAME="get_selected_collection" DATASOURCE="InfoTools">     SELECT * FROM SearchCollections WHERE CollectionName =        '#Form.Selected_Collection#'     </CFQUERY>     <CFQUERY NAME="SalesInteractionInfo" DATASOURCE = "InfoTools">         SELECT InteractionID,ClientName,InteractionDate,SalesPerson,                MinutesOfMeeting,Requirements from SalesInteractions     </CFQUERY>     <CFIF #Form.btnSave# is "Refresh Collection">          <CFSET varAction = "Refresh">     <CFELSE>          <CFSET varAction = "Update">     </CFIF>     <CFOUTPUT QUERY = "get_selected_collection">     <CFLOCK TYPE = "EXCLUSIVE" TIMEOUT="30">     <CFINDEX COLLECTION=#Form.Selected_Collection#         TYPE = "Custom"         ACTION = #varAction#         KEY = "InteractionID"         TITLE = #Title#         BODY = #Body#         QUERY = "SalesInteractionInfo">     </CFLOCK>     </CFOUTPUT>     <CFOUTPUT>     <CFIF #Form.btnSave# is "Refresh Collection">         <P >Collection <U>#Form.Selected_Collection#</U>            is Successfully Refreshed</P>     <CFELSE>         <P >Collection <U>#Form.Selected_Collection#</U>           is Successfully Updated</P>     </CFIF>     </CFOUTPUT> <CFELSE>     <CFIF #Form.InteractionID# LTE 0>         <CFOUTPUT><P >Interaction ID is Required to Remove                Specific Record from the Collection</P></CFOUTPUT>         <CFABORT>     <CFELSE>         <CFQUERY NAME="DeleteSpecific" DATASOURCE="InfoTools">             DELETE FROM SalesInteractions WHERE InteractionID =                      #Form.InteractionID#         </CFQUERY>         <CFLOCK NAME = "DELETE_INDEX" TYPE = "EXCLUSIVE" TIMEOUT = "30">             <CFINDEX             COLLECTION = #Form.Selected_Collection#             ACTION = "Delete"             Key = "#Form.InteractionID#">         </CFLOCK>         <CFOUTPUT>         <P >Record for Interaction ID              <U>#Form.InteractionID#</U> from Collection              <U>#Form.Selected_Collection#</U> is Successfully Deleted</P>         </CFOUTPUT>     </CFIF> </CFIF> </body> </HTML> 
end example

Listing 22.11 provides the complete code for the ProcessDocCollections.cfm page.

Listing 22.11: ProcessDocCollections.cfm

start example
 <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:     Admin Interface</U></B><BR> <B><U>Managing the Collections for Search Application</U></B></DIV> <CFIF #Form.btnSave# is "Optimize Collection">      <CFSET varAction = "Optimize"> <CFELSEIF #Form.btnSave# is "Repair Collection">      <CFSET varAction = "Repair"> <CFELSE>      <CFSET varAction = "Delete"> </CFIF> <CFLOCK TYPE = "EXCLUSIVE" TIMEOUT="30"> <CFCOLLECTION ACTION = #varAction# COLLECTION=#Form.Selected_Collection#> </CFLOCK> <CFIF #Form.btnSave# is "Delete Collection">     <CFQUERY NAME="DeleteCollection" DATASOURCE="InfoTools">              DELETE FROM SearchCollections WHERE CollectionName =                      '#Form.Selected_Collection#'     </CFQUERY> </CFIF> <CFOUTPUT> <CFIF #Form.btnSave# is "Optimize Collection">     <P >Collection <U>#Form.Selected_Collection#</U>       is Successfully Optimized</P> <CFELSEIF #Form.btnSave# is "Repair Collection">     <P >Collection <U>#Form.Selected_Collection#</U>       is Successfully Repaired</P> <CFELSE>     <P >Collection <U>#Form.Selected_Collection#</U>       is Successfully Deleted</P> </CFIF> </CFOUTPUT> </body> </HTML> 
end example

Listing 22.12 provides the complete code for the ShowInteraction.cfm page.

Listing 22.12: ShowInteraction.cfm

start example
 <CFQUERY NAME="SelectSpecific" DATASOURCE="InfoTools">     SELECT * FROM SalesInteractions WHERE InteractionID = #URL.ID# </CFQUERY> <html> <head> <title>Info Tools Search Application</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL = "stylesheet" TYPE ="text/css" HREF ="Project5.css"> </head> <body> <DIV align="center" ><B><U>Info Tools Search Application:     Search Interface</U></B><BR> <B><U>View Interaction Details</U></B></DIV> <BR> <CFOUTPUT QUERY = "SelectSpecific"> <TABLE BORDER=0 cellpadding="4" cellspacing="4" > <TR>     <TD><B>Interaction ID:</B></TD>     <TD>#InteractionID#</TD> </TR> <TR>     <TD><B>Interaction Date:</B></TD>     <TD>#InteractionDate#</TD> </TR> <TR>     <TD><B>Client Name:</B></TD>     <TD>#ClientName#</TD> </TR> <TR>     <TD><B>Sales Person:</B></TD>     <TD>#SalesPerson#</TD> </TR> <TR>     <TD><B>Minutes Of the Meeting:</B></TD>     <TD>#MinutesOfMeeting#</TD> </TR> <TR>     <TD><B>Client's Requirements:</B></TD>     <TD>#Requirements#</TD> </TR> </TABLE> </CFOUTPUT> </body> </HTML> 
end example

Listing 22.13 provides the complete code for the Project5.css file.

Listing 22.13: Project5.css

start example
 body {     background-color: #FFFFCC;     font-family: Arial, Helvetica, sans-serif;     font-size: 12px;     line-height: 24px;     color: #333333; } td, th {     font-family: Tahoma,Arial, Helvetica, sans-serif;     font-size: 10px;     line-height: 24px;     color: #330000; } a {     color: #330000; } form {     background-color: #CCCC99; } div {     background-color: #CCCC99; } .title {     font-family: Georgia, "Times New Roman", Times, serif;     font-size: 18px;     line-height: 30px;     background-color: #990000; color: #FFFF66; } a:hover {     color: #DEDECA;     background-color: #330000; } .message {     font-family: Tahoma, Arial, Helvetica, sans-serif;     font-size: 14px;     font-weight: bold;     line-height: 30px;     color: #990000;     background-color: #CCCC99; } .summary {     font-family: Tahoma, Arial, Helvetica, sans-serif;     font-size: 10px;     line-height: 30px;        background-color: #CCCC99; } cfform {     background-color: #CCCC99; } 
end example




Macromedia ColdFusion MX. Professional Projects
ColdFusion MX Professional Projects
ISBN: 1592000126
EAN: 2147483647
Year: 2002
Pages: 200

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net