Any thoughts or commnets from anyone who may have downloaded this?

If interested I fixed a couple quick minor things in _search.cfm (missing ending </span> tags, cleaned the cfscript url validation, moved the two customizable variables to the top of the code, etc). The file is attached (v2.0 Beta2).

Is anyone planning on making any layout or code changes (or suggestions)? If not I plan on packaging this up as final and sending it off to Daemon (after making any last-minute updates).

Regards,

-Jeff C.
<cfsetting enablecfoutputonly="yes" />
<!--------------------------------------------------------------------
Search Results (template):
 - dmInclude (_search.cfm)
Version: v2.0 Beta2
Date: 2004-09-21
Note: Please feel free to customize the two variables near the top of the code
      "url.show" and "Variables.NumOfBar_total"
--------------------------------------------------------------------->
<!--- @@displayname: Search Results Page --->
<!--- @@author: Jeff Coughlin ([EMAIL PROTECTED]), Geoff Bowers ([EMAIL PROTECTED]) 
--->

<!--- declare variables --->
<cfparam name="url.strt" default="1" /> <!--- Please do not edit --->
<cfparam name="url.show" default="10" /> <!--- CUSTOMIZE ME! - How many records per 
page you'd like displayed --->
<cfset Variables.NumOfBars_total = 20 /> <!--- CUSTOMIZE ME! - How many number of bars 
displayed after page score percentage --->

<!--- get active verity collections --->
<cfset Variables.lCollections = arrayToList(application.config.verity.aIndices) />

<!--- inbound parameters defaults --->
<cfparam name="form.criteria" default="" />
<cfparam name="form.searchOperator" default="" />
<cfparam name="form.searchformsubmitted" default="0" />

<!---  If form was sent, use cflocation (to allow refresh key without re-submitting to 
form)
       It also allows them to copy and paste the URL to send to someone else.
       Please add the following hidden variable to your subsequent search forms which 
refer
       to this page as the action page
           <input type="hidden" name="searchformsubmitted" value="1" />
--->
<cfif form.searchformsubmitted eq 1>
        <cflocation addtoken="no" 
url="#application.url.webroot#/index.cfm?objectid=#url.objectid#&criteria=#form.criteria#&searchOperator=#form.searchOperator#&strt=#url.strt#&show=#url.show#"
 />
</cfif>

<cfscript>
        // check if called from x page in results
        if (IsDefined("url.criteria")){
                form.criteria = url.criteria;}
        if (IsDefined("url.searchOperator")){
                form.searchOperator = url.searchOperator;}

        /* START - Prepare Verity */
                // check for verity reserved words
                if (findNoCase("not", trim(form.criteria)) or findNoCase("or", 
trim(form.criteria)) or findNoCase("and", trim(form.criteria))){
                        form.searchOperator = "Custom";}
                
                // treat search criteria with appropriate Verity operator
                switch (form.searchOperator)
                {
                        case "ALL" :{
                                Variables.SearchCriteria = 
replacenocase(trim(form.criteria), " ", " AND ", "ALL");
                                break;
                        }case "Custom" :{
                                Variables.SearchCriteria = trim(form.criteria);
                                break;
                        }case "PHRASE" :{
                                Variables.SearchCriteria = 
replacenocase(trim(form.criteria), " ", "<PHRASE>", "ALL");
                                break;
                        }default :{ // (default) treat as ANY
                                if (not findNoCase("not", trim(form.criteria))) {
                                        SearchCriteria = 
replacenocase(trim(form.criteria), ",", "", "ALL");
                                        SearchCriteria = 
replacenocase(trim(form.criteria), " ", " OR ", "ALL");
                                }else{
                                        SearchCriteria = trim(form.criteria);}
                                break;
                        }
                }
        
                // get serach results
                if (len(form.criteria)){
                qResults = 
application.factory.oVerity.search(lCollections=Variables.lCollections,searchString=Variables.SearchCriteria);}
        /* END - Prepare Verity */
</cfscript>

<cfimport taglib="/farcry/farcry_core/tags/webskin" prefix="skin" />

<cfoutput>
<p></p>
<form action="#application.url.conjurer#?objectid=#application.navid.search#" 
method="post" style="margin:10px,0,15,30px;">
<input type="text" name="criteria" value="#form.criteria#" />
<input type="hidden" name="searchformsubmitted" value="1" />
<select name="searchOperator">
        <option value="ANY"<cfif form.SearchOperator eq "ANY"> 
selected="selected"</cfif>>Any of these words</option>
        <option value="ALL"<cfif form.SearchOperator eq "ALL"> 
selected="selected"</cfif>>All of these words</option>
        <option value="PHRASE"<cfif form.SearchOperator eq "PHRASE"> 
selected="selected"</cfif>>These words as a phrase</option>
</select>
<input type="submit" name="action" value="Search" class="searchSubmit" />
</form>
</cfoutput>


<cfif isDefined("qResults") AND qResults.recordCount gt 0>
        <!--- START - Set Usable Variables --->
        <cfscript>
                // START - Validate for mailicious url variables:
                /* 1. must be [numeric] */
                url.strt = IIF(isNumeric(url.strt), url.strt, 1);
                url.show = IIF(isNumeric(url.show), url.show, 1);
                /* 2. must be [whole integers] */
                url.strt = round(url.strt);
                url.show = round(url.show);
                /* 3. cannot be less than one (otherwise possible page crashing) */
                url.strt = IIF(url.strt gte 1, url.strt, 1);
                url.show = IIF(url.show gte 1, url.show, 1);
                // END - Validate for mailicious url variables:

                // Set local variables for displaying record page information
                Variables.END_Number = url.strt + url.show;
                if (Evaluate(qResults.recordcount - url.strt) LT url.show){
                        Variables.END_Number = qResults.Recordcount;
                }
        </cfscript>
        <!--- END - Set Usable Variables --->

        <cfoutput>
        <table border="0" cellpadding="2" cellspacing="0" align="center" width="100%">
                <tr bgcolor="##e0e0e0">
                        <td nowrap="nowrap" style="padding-left: 5px;">Found 
<strong>#qResults.recordcount#</strong> result<cfif qResults.recordcount NEQ 
1>s</cfif></td>
                        <td nowrap="nowrap" style="padding-right: 5px; text-align: 
right;">
                                <cfif Evaluate(qResults.recordcount - (url.strt - 1)) 
LTE url.show>
                                        Results <strong><cfif qResults.recordcount NEQ 
0>#url.strt# - </cfif>#Variables.END_Number#</strong>
                                <cfelse>
                                        Results <strong><cfif qResults.recordcount NEQ 
0>#url.strt# - </cfif>#Evaluate(Variables.END_Number - 1)#</strong>
                                </cfif>
                        </td>
                </tr>
        </table>
        <br />
        </cfoutput>
        <!--- output results --->
        <cfset countthisrow = 0 />
        <cfoutput query="qResults" maxrows="#url.show#" startrow="#url.strt#">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                                <td>
                                <!--- check for extFile or farcry object --->
                                <cfif left(key,2) eq "\\">
                                        <a 
href="#application.url.webroot#/download.cfm?extFile=#key#"><strong>#qResults.title#</strong></a>
                                <cfelse>
                                        <!--- farcry object --->
                                        <a 
href="#application.url.conjurer#?objectid=#key#"><strong>#qResults.title#</strong></a>
                                </cfif>
                                </td>
                                <td nowrap="nowrap" align="right">
                                <span style="font-family: Verdana, Arial, Helvetica, 
sans-serif; color: ##959595; font-size: 9px;">#score#</span>
                                <cfset NumOfBars_Highlight = 
round(replace(score,"%","","all")*(NumOfBars_total/100)) />
                                <cfset NumOfBars_Shadow = 
NumOfBars_total-NumOfBars_Highlight />
                                <cfif NumOfBars_Highlight gt 0><span 
style="font-family: Georgia, 'Times New Roman', Times, 'New York', serif; color: 
##0000d0; font-size: 9px;"><cfloop index="i" from="1" 
to="#NumOfBars_Highlight#">|</cfloop></span></cfif><cfif NumOfBars_Shadow gt 0><span 
style="font-family: Georgia, 'Times New Roman', Times, 'New York', serif; color: 
##c0c0c0; font-size: 9px;"><cfloop index="i" from="1" 
to="#NumOfBars_Shadow#">|</cfloop></span></cfif>
                                </td>
                        </tr>
                        <tr>
                                <td colspan="2">#summary#</td>
                        </tr>
                </table>
                <cfset countthisrow = IncrementValue(countthisrow) />
                <cfif countthisrow neq url.show><hr size=1 width="100%" /></cfif>
        </cfoutput>
        <cfoutput>
        <br />
        <table border="0" cellpadding="0" cellspacing="0" align="center" width="100%">
        <tr bgcolor="##e0e0e0">
        <td width="100%"></cfoutput>
        <!--- show previous/next links --->
                <skin:Search_NextPrevious
                        QueryRecordCount="#qResults.RecordCount#"
                        FileName="#application.url.conjurer#"
                        objectID="#url.objectID#"
                        MaxresultPages="5"
                        MaxRowsAllowed="#url.show#"
                        PageText="Page:&nbsp;"
                        LayoutNumber="2"
                        FirstLastPage="numeric"
                        EnableClasses="0"
                        Separator_mid="&nbsp;"
                        CurrentPageWrapper_start="&nbsp;["
                        CurrentPageWrapper_end="]&nbsp;"
                        
ExtraURLString="criteria=#form.criteria#&searchOperator=#form.searchOperator#">
                <cfoutput>
        </td>
        </tr>
        </table>
        </cfoutput>
<cfelseif trim(form.criteria) neq ''>
        <cfoutput><div style="margin:0,0,10px,30px;">Your search for "#form.criteria#" 
produced no results.</div></cfoutput>
</cfif>

<cfsetting enablecfoutputonly="no" />
---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to