root/swish_website/lib/page/search.html

Revision 1889, 7.2 kB (checked in by moseley, 2 years ago)

More updates getting ready to move to the new host
Combined the two search scripts into one.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 [%- # $id$
2     # Page for showing search results
3 -%]
4 [%- META
5     author = '$Author$'
6 -%]
7
8
9 <div class="search-page">
10 [%-
11
12     page.title = 'Search';
13     page.no_search = 1;
14
15     include_javascript( 'search' );
16
17
18     MACRO message(text) BLOCK;
19         '<div class="search-message">';
20         text;
21         '</div>';
22         page.title = text | html;
23     END;
24
25     page_ids = {};
26     MACRO radio( name, value, label, checked ) BLOCK;
27         page_ids.$name = page_ids.$name + 1;
28         id = page_ids.$name;
29         ck = checked ? ' checked="checked"' : '';
30         %]
31         <input id="[% name; id %]" type="radio" name="[% name %]" value="[% value | html %]"[% ck %]/>
32         <label for="[% name; id %]">[% label | html %]</label>
33         [%
34     END;
35
36
37     MACRO select( name, value, label, checked ) BLOCK;
38         ck = checked ? ' selected="selected"' : '';
39         %]
40         <option id="[% name; value %]" value="[% value | html %]"[% ck %]>[% label | html %]</option>
41         [%
42     END;
43
44     USE myurl = url( request.myself, query=request.query,
45                      metaname=request.metaname, size=request.pagesize );
46
47     result_date = Date;  # set date format for results
48
49
50
51     PROCESS search_form;
52
53
54     IF result;
55         # Show results
56
57         message( result.message ) IF result.message;
58
59
60         IF result.results.size;
61
62             SET query_html = request.query | html;
63             page.title = "[$query_html] $result.results.size results";
64             PROCESS results_header;
65             PROCESS next_links;
66             PROCESS display_results;
67             PROCESS next_links;
68         ELSE;
69             message( "No Results Found" );
70         END;
71     END;
72 -%]
73 </div>
74
75 <div id="hidingplace" style="display:none"></div>
76
77
78
79 [% BLOCK search_form %]
80 <form id="searchform" method="get" action="index.html">
81     <h2>Enter your query</h2>
82     <div id="simpleform">
83         <input type="text" size="30" name="query" />
84         <input type="submit" name="submit" value="Search!" />
85     </div>
86     <div id="advancedform" style="display: none">
87         <input id="advflag" name="adv" type="hidden" value="0" />
88         Limit to:
89         [%
90             radio( 'meta', '', 'Subject/Title & Body', 1 );
91             radio( 'meta', 'title', 'Subject/Title' );
92             radio( 'meta', 'name', "Poster's Name" );
93             radio( 'meta', 'email', "Poster's Email" );
94         %]
95
96         <br />
97
98         Search:
99         <select name="section">
100         [%
101             select( 'section', '', 'Everywhere',1 );
102             select( 'section', 'docs', 'Documentation' );
103             select( 'section', 'devel', 'Development Docs' );
104             select( 'section', 'archive', 'List Archives' );
105             select( 'section', 'website', 'Site web pages' );
106         %]
107         </select>
108
109         Sort by:
110         <select name="sort">
111             <option value="rank">Rank</option>
112             <option value="title">Subject/Title</option>
113             <option value="email">Email</option>
114             <option value="date">Date</option>
115         </select>
116         <input id="rsort" type="checkbox" name="reverse" /><label for="rsort">Reverse Sort</label>
117
118         <br />
119         Limit to date:
120         [%
121             radio( 'date', '', 'All', 1);
122             radio( 'date', 'day', 'Today' );
123             radio( 'date', 'week', 'This Week' );
124             radio( 'date', 'month', 'This Month' );
125             radio( 'date', '90', 'Last 90 Days' );
126             '<br />';
127             radio( 'date', 'select', 'Select date range' );
128
129
130             PROCESS select_date name = 's';
131             ' through ';
132             PROCESS select_date name = 'e';
133         %]
134     </div><!-- /#advancedform -->
135 </form>
136 [% END %]
137
138 [% BLOCK select_date %]
139     <select name="[% name %]month">
140         <option value="1">Jan</option>
141         <option value="2">Feb</option>
142         <option value="3">Mar</option>
143         <option value="4">Apr</option>
144         <option value="5">May</option>
145         <option value="6">Jun</option>
146         <option value="7">Jul</option>
147         <option value="8">Aug</option>
148         <option value="9">Sep</option>
149         <option value="10">Oct</option>
150         <option value="11">Nov</option>
151         <option value="12">Dec</option>
152     </select>
153     &nbsp;
154     <select name="[% name %]day">
155     [% i = 1;  WHILE i < 32 %]
156         <option value="[% i %]">[% i %]</option>
157     [% i = i + 1; END %]
158     </select>
159     &nbsp;
160     <select name="[% name %]year">
161     [% i = cur_year; WHILE i > 1995 %]
162         <option value="[% i %]">[% i %]</option>
163     [% i = i - 1; END %]
164     </select>
165 [% END %]
166
167
168
169
170
171 [% BLOCK display_results %]
172     <div class="search-results">
173
174     [% FOREACH item = result.results %]
175         <div class="search-result">
176             [% PROCESS show_result %]
177         </div>
178     [% END %]
179     </div>
180 [% END %]
181
182
183
184 [% BLOCK results_header %]
185 <div class="search-header">
186     Results for <b>[% request.query | html %]</b><br />
187 </div>
188 [% END %]
189
190
191
192
193 [% BLOCK next_links %]
194     Showing page [% result.page %]
195     ([% result.start +1 %] - [% (result.start + result.shown) %] of [% result.hits %] hits)
196
197     [% IF result.prev %]
198        <a class="next" href="[% myurl( page=result.prev ) %]">Previous</a>
199     [% END %]
200     [% IF result.next %]
201        <a class="prev" href="[% myurl( page=result.next ) %]">Next</a>
202     [% END %]
203 [% END %]
204
205
206 [% BLOCK show_result %]
207     [%
208         SET doc_path    = item.Property('swishdocpath');
209         SET is_list     = doc_path.match('/archive/');
210         SET is_devel    = doc_path.match('/devel_docs/');
211         SET is_docs     = doc_path.match('/docs/');
212     %]
213
214     <h2 id="result-heading">
215         <a href="[% item.Property('swishdocpath') %]">
216             [%  item.Property('swishtitle') || 'missing title' | highlight('swishtitle', item ) %]
217         </a>
218     </h2>
219
220     <div class="search-subtitle">
221         [% IF is_list %]
222             <span class='indxtype'>[List Archive]</span>
223         [% ELSIF is_devel %]
224             <span class='indxtype'>[Development Docs]</span>
225         [% ELSIF is_docs %]
226             <span class='indxtype'>[Docs]</span>
227         [% END %]
228
229         <span class="search-rank">Rank: <b>[% item.Property('swishrank') %]</b></span>
230     </div>
231
232     <div class="search-description">
233         [% item.Property('swishdescription') || "No description" | highlight('swishdescription', item) %]
234     </div>
235
236     <div class="search-metadata">
237         Path: <a href="[% item.Property('swishdocpath') %]">
238             [% item.Property('swishdocpath') | highlight('swishdocpath', item ) %]</a><br />
239         Size: [% item.Property('swishdocsize') %] bytes<br />
240         Date: [% result_date.format( item.Property('swishlastmodified')) %]<br />
241
242         [% PROCESS show_list_links IF is_list %]
243
244         [% IF is_devel %]
245             Warning: <b>** Development Documentation **</b>
246         [% END %]
247     </div>
248
249 [% END %]
250
251 [% BLOCK show_list_links %]
252
253     [%
254         SET name    = item.Property('name');
255         SET email   = item.Property('email');
256         SET name_href = myurl( query="\"$name\"", meta="name" );
257         SET email_href = myurl( query="\"$email\"", meta="email" );
258     %]
259
260
261         Poster's Name: <a href="[% name_href %]" title="All posts from this name">[% name | html %]</a><br />
262         Poster's Email: <a href="[% email_href %]" title="All posts from this email">[% email | html %]</a>
263
264 [% END %]
265
Note: See TracBrowser for help on using the browser.