root/trunk/website/forums/search.cfm @ 21

Revision 5, 4.0 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly=true>
2<!---
3        Name         : search.cfm
4        Author       : Raymond Camden
5        Created      : July 5, 2004
6        Last Updated : September 6, 2006
7        History      : Add search log
8                                   Removed mappings (rkc 8/27/05)
9                                   Limit search length (rkc 10/30/05)
10                                   auto focus on search box (rkc 7/12/06)
11                                   title fix (rkc 8/4/06)
12                                   js fix by imtiyaz (rkc 9/6/06)
13        Purpose          : Displays form to search.
14--->
15
16<cfparam name="form.searchterms" default="">
17<cfset form.searchterms = trim(htmlEditFormat(application.galleon.utils.searchSafe(form.searchterms)))>
18<cfparam name="form.searchtype" default="phrase">
19
20<!--- Loads header --->
21<cfmodule template="tags/layout.cfm" templatename="main" title="#application.galleon.settings.title# : Search">
22
23<!--- Handle attempted search --->
24<cfif len(form.searchterms)>
25
26        <cfif not listFindNoCase("phrase,any,all", form.searchtype)>
27                <cfset form.searchtype = "phrase">
28        </cfif>
29                 
30        <!---
31                search multiple items:
32                        conferences (name/desc)
33                        forums (name/desc)
34                        threads (name)
35                        messages (title/body)
36        --->
37       
38        <cfset conferences = application.galleon.conference.search(form.searchterms, form.searchtype)>
39        <cfset forums = application.galleon.forum.search(form.searchterms, form.searchtype)>
40        <cfset threads = application.galleon.thread.search(form.searchterms, form.searchtype)>
41        <cfset messages = application.galleon.message.search(form.searchterms, form.searchtype)>
42       
43        <cfset application.galleon.utils.logSearch(form.searchTerms, application.galleon.settings.dsn, application.galleon.settings.tableprefix)>
44        <cfset totalResults = conferences.recordCount + forums.recordCount + threads.recordCount + messages.recordCount>
45       
46</cfif>
47
48<cfoutput>
49<p>
50<table width="500" cellpadding="6" class="tableDisplay" cellspacing="1" border="0">
51        <tr class="tableHeader">
52                <td class="tableHeader">Search</td>
53        </tr>
54        <tr class="tableRowMain">
55                <td>
56                <form action="#cgi.script_name#?#cgi.query_string#" method="post" id="searchForm">
57                <table>
58                        <tr>
59                                <td><b>Search Terms:</b></td>
60                                <td><input type="text" name="searchterms" value="#form.searchterms#" class="formBox" maxlength="100"></td>
61                        </tr>
62                        <tr>
63                                <td><b>Match:</b></td>
64                                <td>
65                                <select name="searchtype" class="formDropDown">
66                                        <option value="phrase" <cfif form.searchtype is "phrase">selected</cfif>>Phrase</option>
67                                        <option value="any" <cfif form.searchtype is "any">selected</cfif>>Any Word</option>
68                                        <option value="all" <cfif form.searchtype is "all">selected</cfif>>All Words</option>
69                                </select>       
70                                </td>
71                        </tr>
72                        <tr>
73                                <td>&nbsp;</td>
74                                <td align="right"><input type="image" src="images/btn_search.gif" alt="Search" width="59" height="19"></td>
75                        </tr>
76                </table>
77                </form>
78                </td>
79        </tr>
80        <cfif isDefined("variables.totalResults")>
81                <tr class="tableRowMain">
82                        <td>
83                                <p>
84                                <b>Results in Conferences:</b><br>
85                                <cfif conferences.recordCount>
86                                        <cfloop query="conferences">
87                                        <a href="forums.cfm?conferenceid=#id#">#name#</a><br>
88                                        </cfloop>
89                                <cfelse>
90                                No matches.
91                                </cfif>
92                                </p>
93                                <p>
94                                <b>Results in Forums:</b><br>
95                                <cfif forums.recordCount>
96                                        <cfloop query="forums">
97                                        <a href="threads.cfm?forumid=#id#">#name#</a><br>
98                                        </cfloop>
99                                <cfelse>
100                                No matches.
101                                </cfif>
102                                </p>
103                                <p>
104                                <b>Results in Threads:</b><br>
105                                <cfif threads.recordCount>
106                                        <cfloop query="threads">
107                                        <a href="messages.cfm?threadid=#id#">#name#</a><br>
108                                        </cfloop>
109                                <cfelse>
110                                No matches.
111                                </cfif>
112                                </p>
113                                <p>
114                                <b>Results in Messages:</b><br>
115                                <cfif messages.recordCount>
116                                        <cfloop query="messages">
117                                        <a href="messages.cfm?threadid=#threadidfk#">#title#</a><br>
118                                        </cfloop>
119                                <cfelse>
120                                No matches.
121                                </cfif>
122                                </p>
123
124                        </td>
125                </tr>
126        </cfif>
127</table>
128</p>
129<script>
130window.onload = function() {document.getElementById("searchForm").searchterms.focus();}
131</script>
132</cfoutput>
133       
134</cfmodule>
135
136<cfsetting enablecfoutputonly=false>
Note: See TracBrowser for help on using the browser.