comparison src/nabble/view/naml/search.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1 <macro name="search_page" requires="servlet">
2 <n.search_page_html/>
3 </macro>
4
5 <macro name="search_page_html" requires="servlet">
6 <n.define_search_query_field/>
7 <n.node_page.search_namespace.>
8 <n.set_var name='didSearch' value="false" />
9 <n.catch_exception. id="search-block">
10 <n.do_search_using_params />
11 <n.set_var name='didSearch' value="true" />
12 </n.catch_exception.>
13 <n.html>
14 <head>
15 <meta name="robots" content="noindex,nofollow"/>
16 <n.search_page_title/>
17 <n.set_cookies did_search="[n.var name='didSearch'/]" />
18 <n.search_page_style/>
19 </head>
20 <body>
21 <n.show_search_form/>
22 <n.show_search_error/>
23 <n.search_results_header/>
24
25 <n.results.loop.current_node.>
26 <n.search_result_row/>
27 </n.results.loop.current_node.>
28
29 <n.search_pagination/>
30
31 <n.if.not.lucene_is_ready>
32 <then.index_rebuilt_notice/>
33 </n.if.not.lucene_is_ready>
34
35 <n.if.has_results>
36 <then.show_search_form/>
37 </n.if.has_results>
38 </body>
39 </n.html>
40 </n.node_page.search_namespace.>
41 </macro>
42
43 <macro name="search_page_title" requires="search">
44 <n.title.>
45 <n.case_all.>Search for '<n.search_query_field.value/>'</n.case_all.>
46 <n.case_author_search.>Messages of <n.user.name/></n.case_author_search.>
47 </n.title.>
48 </macro>
49
50 <macro name="search_page_style" requires="search">
51 <style type="text/css">
52 .nabble td.verbose-search-box {
53 text-align: left;
54 padding-top: .33em;
55 padding-bottom: .33em;
56 padding-left: .17em;
57 }
58 div.search-results-header {
59 margin:2em 0 1em;
60 font-size:90%;
61 }
62 </style>
63 </macro>
64
65 <macro name="search_results_header" requires="search">
66 <div class="search-results-header">
67 <n.if.has_resort>
68 <then>
69 <n.sort_controls/>
70 </then>
71 </n.if.has_resort>
72
73 <img src="/images/search.png" class="image16"/>
74 Found <n.total_posts/> <n.search_description/>
75 </div>
76 </macro>
77
78 <macro name="search_result_row" requires="node,search">
79 <div style="margin-bottom:1.5em">
80 <div style="margin-bottom:.2em" class="adbayes-content">
81 <n.search_result_topic_subject/>
82 <n.search_result_post_subject/>
83 </div>
84
85 <div style="margin-bottom:.2em" class="adbayes-content">
86 <n.search_result_message_fragment/>
87 </div>
88
89 <div class="weak-color" style="font-size:80%">
90 <n.search_result_in_app/>
91 <n.search_result_on_date/>
92 <n.if.not.is_author_search>
93 <then>
94 by <n.owner.user_link/>
95 </then>
96 </n.if.not.is_author_search>
97 &mdash; <n.topic_node.replies/> replies in thread
98 </div>
99 </div>
100 </macro>
101
102 <macro name="search_result_topic_subject" requires="node,search">
103 <span class="second-font big-title">
104 <n.node_link text="[n.highlight.topic_node.subject/]" />
105 </span>
106 </macro>
107
108 <macro name="search_result_post_subject" requires="node,search">
109 <n.if.not.regex_matches pattern=".*[n.regex_quote.topic_node.subject/]" text="[n.subject/]">
110 <then>&nbsp; (<n.highlight.subject/>)</then>
111 </n.if.not.regex_matches>
112 </macro>
113
114 <macro name="search_result_message_fragment" requires="node,search">
115 <n.highlight.hide_emails.fragment. size="300">
116 <n.message.as_text/>
117 </n.highlight.hide_emails.fragment.>
118 </macro>
119
120 <macro name="search_result_in_app" requires="node,search">
121 <n.if.is_in_app>
122 <then>
123 in <n.get_app_node.><n.node_link text="[n.highlight.subject/]" /></n.get_app_node.>
124 </then>
125 </n.if.is_in_app>
126 </macro>
127
128 <macro name="search_result_on_date" requires="node,search">
129 <script type="text/javascript">
130 Nabble.postDate = new Date(<n.when_created.raw_time/>);
131 document.write(Nabble.isToday(Nabble.postDate) ? " at " : " on ");
132 document.write(Nabble.formatDateShort(Nabble.postDate));
133 </script>
134 </macro>
135
136
137 <macro name="search_pagination" requires="search">
138 <n.search_paging.>
139 <n.if.has_paging>
140 <then>
141 <div style="font-size:90%;text-align:right;margin-bottom:1em">
142 <n.if.has_previous_page>
143 <then>
144 <a href="[n.previous_page_path/]">&laquo; Prev <n.rows_per_page/></a>
145 <n.if.has_next_page>
146 <then> - </then>
147 </n.if.has_next_page>
148 </then>
149 </n.if.has_previous_page>
150 <n.if.has_next_page>
151 <then>
152 <a href="[n.next_page_path/]">Next <n.rows_per_page/> &raquo;</a>
153 </then>
154 </n.if.has_next_page>
155 </div>
156 </then>
157 </n.if.has_paging>
158 </n.search_paging.>
159 </macro>
160
161 <macro name="index_rebuilt_notice" requires="search">
162 <div class="info-message rounded" style="text-align:center;padding:.5em;margin:.5em 0">
163 <t><b>Warning:</b> The search index is currently being rebuilt. Search results may be incomplete.</t>
164 </div>
165 </macro>
166
167 <macro name="sort_controls" requires="search">
168 <div style="float:right;margin:0 1em">
169 <n.if.sorted_by_date>
170 <then>
171 <a href="[n.sort_by_relevance_path/]"><t>Sort by relevance</t></a> | <t>Sorted by date</t>
172 </then>
173 <else>
174 <t>Sorted by relevance</t> | <a href="[n.sort_by_date_path/]"><t>Sort by date</t></a>
175 </else>
176 </n.if.sorted_by_date>
177 </div>
178 </macro>
179
180 <macro name="search_description" requires="search">
181 <n.if.has_query>
182 <then>matching posts for <b><n.search_query_field.value/></b></then>
183 <else>posts</else>
184 </n.if.has_query>
185 in <n.page_node.node_link/>
186 <n.case_author_search.>
187 by <n.user.user_link/>
188 </n.case_author_search.>
189 <n.if.has_days>
190 <then>within <n.days/> days</then>
191 </n.if.has_days>
192 <n.search_paging.>
193 <n.if.has_paging>
194 <then>Showing posts <n.current_page.page_row.plus.one/> to <n.current_page.page_row.plus.rows_per_page/>.</then>
195 </n.if.has_paging>
196 </n.search_paging.>
197 </macro>
198
199 <macro name="show_search_error" requires="search">
200 <n.format_error.handle_exception. for="search-block">
201 <n.exception. name="search_query_parse_error">
202 This query is invalid.
203 <br/>For more information, read about <a href="http://lucene.apache.org/java/2_4_1/queryparsersyntax.html">Lucene query parser syntax</a>
204 </n.exception.>
205 <n.exception. name="too_many_search_clauses">
206 Your search will give too many matches.
207 </n.exception.>
208 </n.format_error.handle_exception.>
209 </macro>
210
211 <macro name="show_search_form" requires="search">
212 <div class="shaded-bg-color rounded">
213 <n.page_node.search_form.>
214 <table>
215 <tr>
216 <td class="verbose-search-box">
217 <style type="text/css">
218 div.field-title { margin-top: 0; }
219 </style>
220 <div class="second-font field-title">Search</div>
221 <n.case_author_search.>
222 <select name="author">
223 <option value="[n.author_param/]" selected="true">posts by '<n.user.name/>'</option>
224 <option value="">all posts</option>
225 </select>
226 </n.case_author_search.>
227 <n.search_query_field.input size="40" />
228 <select name="days">
229 <n.if.not.contains_substring string="-0-1-7-30-90-180-365-" substring="-[n.days/]-">
230 <then>
231 <n.days_option. value="[n.days/]">past <n.days/> days</n.days_option.>
232 </then>
233 </n.if.not.contains_substring>
234 <n.days_option. value="0">all dates</n.days_option.>
235 <n.days_option. value="1">past 24 hours</n.days_option.>
236 <n.days_option. value="7">past week</n.days_option.>
237 <n.days_option. value="30">past month</n.days_option.>
238 <n.days_option. value="90">past 3 months</n.days_option.>
239 <n.days_option. value="180">past 6 months</n.days_option.>
240 <n.days_option. value="365">past year</n.days_option.>
241 </select>
242 &nbsp;<input type="submit" value="Go &raquo;" />
243 </td>
244 <td style="font-size:90%;padding:0 0 .3em 1em;vertical-align:bottom">
245 <div style="margin-bottom:.4em">
246 <a href="[n.advanced_search_path_using_params/]">Advanced Search</a>
247 </div>
248 <a href="[n.help.search.url/]">Show Tips</a>
249 </td>
250 </tr>
251 </table>
252 </n.page_node.search_form.>
253 </div>
254 </macro>
255
256 <macro name="case_all" requires="search" dot_parameter="do">
257 <n.if.is_all>
258 <then><n.do/></then>
259 </n.if.is_all>
260 </macro>
261
262 <macro name="case_author_search" requires="search" dot_parameter="do">
263 <n.if.is_author_search>
264 <then><n.do/></then>
265 </n.if.is_author_search>
266 </macro>
267
268 <macro name="days_option" requires="search" parameters="value" dot_parameter="text">
269 <n.option. value="[n.value/]" selected="[n.days/]"><n.text/></n.option.>
270 </macro>
271
272 <macro name="option" parameters="value,selected" dot_parameter="text">
273 <n.if.equal value1="[n.value/]" value2="[n.selected/]">
274 <then>
275 <option value="[n.value/]" selected="true"><n.text/></option>
276 </then>
277 <else>
278 <option value="[n.value/]"><n.text/></option>
279 </else>
280 </n.if.equal>
281 </macro>
282
283 <macro name="define_search_query_field">
284 <n.if.not.is_null.search_query_field.value>
285 <then>
286 <n.search_query_field.set_value.>
287 <n.regex_replace_all. pattern="\band\b" replacement="AND">
288 <n.regex_replace_all. pattern="\bor\b" replacement="OR">
289 <n.trim.search_query_field.value/>
290 </n.regex_replace_all.>
291 </n.regex_replace_all.>
292 </n.search_query_field.set_value.>
293 </then>
294 </n.if.not.is_null.search_query_field.value>
295 </macro>
296
297 <macro name="search_query_field" dot_parameter="do">
298 <n.field. name="query"><n.do/></n.field.>
299 </macro>
300
301 <macro name="do_search_using_params" requires="search">
302 <n.if.not.is_empty.author_param>
303 <then.query_author.author_param/>
304 </n.if.not.is_empty.author_param>
305 <n.do_search length="[n.search_page_length/]"
306 query="[n.query_param/]"
307 days="[n.get_parameter name='days'/]"
308 start="[n.search_page_index_record/]"
309 sort="[n.get_parameter name='sort'/]"
310 />
311 </macro>
312
313 <macro name="author_param">
314 <n.get_parameter name='author'/>
315 </macro>
316
317 <macro name="query_param">
318 <n.get_parameter name='query'/>
319 </macro>
320
321
322
323 <macro name="previous_page_path" requires="paging,search">
324 <n.search_path_using_params index_record="[n.previous_page.page_row/]" />
325 </macro>
326
327 <macro name="next_page_path" requires="paging,search">
328 <n.search_path_using_params index_record="[n.next_page.page_row/]" />
329 </macro>
330
331 <macro name="sort_by_relevance_path">
332 <n.search_path_using_params sort="relevance" index_record="0" />
333 </macro>
334
335 <macro name="sort_by_date_path">
336 <n.search_path_using_params sort="date" index_record="0" />
337 </macro>
338
339 <macro name="search_path_using_params" parameters="query,author,days,index_record,sort" requires="node_page,servlet">
340 <n.page_node.>
341 <n.search_path>
342 <query><n.default_to_param name="query" value="[n.query/]" /></query>
343 <author><n.default_to_param name="author" value="[n.author/]" /></author>
344 <days><n.default_to_param name="days" value="[n.days/]" /></days>
345 <index_record><n.default_to_param name="index_record" value="[n.index_record/]" /></index_record>
346 <sort><n.default_to_param name="sort" value="[n.sort/]" /></sort>
347 </n.search_path>
348 </n.page_node.>
349 </macro>
350
351 <macro name="default_to_param" parameters="name" dot_parameter="value">
352 <n.default>
353 <text><n.value/></text>
354 <to><n.get_parameter name="[n.name/]"/></to>
355 </n.default>
356 </macro>
357
358 <macro name="search_path" parameters="query,author,days,index_record,sort" requires="node">
359 <n.encode_url.remove_spaces.>
360 /template/NamlServlet.jtp?macro=search_page&node=<n.id/>
361 <n.add_to_path name="query" value="[n.query/]" />
362 <n.add_to_path name="author" value="[n.author/]" />
363 <n.add_to_path name="days" value="[n.days/]" />
364 <n.add_to_path name="i" value="[n.index_record/]" default_value="0" />
365 <n.add_to_path name="sort" value="[n.sort/]" default_value="relevance" />
366 </n.encode_url.remove_spaces.>
367 </macro>
368
369 <macro name="page_search_box" parameters="author" requires="node,servlet">
370 <n.search_form.
371 style="display: inline; margin: 0;"
372 author="[n.author/]"
373 >
374 <input id="nabble.searchQuery" type="text" class="medium-border-color" name="query" size="20" />
375 </n.search_form.>
376 </macro>
377
378 <macro name="search_form" dot_parameter="do" parameters="style,query,author,days" requires="node">
379 <form style="[n.style/]" action="/template/NamlServlet.jtp">
380 <input type="hidden" name="macro" value="search_page" />
381 <input type="hidden" name="node" value="[n.id/]" />
382 <n.hidden_field name="query" value="[n.query/]" />
383 <n.hidden_field name="author" value="[n.author/]" />
384 <n.hidden_field name="days" value="[n.days/]" />
385 <n.do/>
386 </form>
387 </macro>
388
389 <macro name="hidden_field" parameters="name,default_value" dot_parameter="value">
390 <n.if.not.is_null.value>
391 <then>
392 <n.if.not.equal value1="[n.value/]" value2="[n.default_value/]">
393 <then>
394 <input type='hidden' name="[n.name/]" value="[n.value/]"/>
395 </then>
396 </n.if.not.equal>
397 </then>
398 </n.if.not.is_null.value>
399 </macro>
400
401 <macro name="advanced_search_path_using_params" parameters="days" requires="node">
402 <n.advanced_search_path>
403 <days><n.default_to_param name="days" value="[n.days/]" /></days>
404 </n.advanced_search_path>
405 </macro>
406
407 <macro name="advanced_search_path" parameters="days" requires="node">
408 <n.encode_url.remove_spaces.>
409 /template/NamlServlet.jtp?macro=adv_search_page&node=<n.id/>
410 <n.add_to_path name="days" value="[n.days/]" />
411 </n.encode_url.remove_spaces.>
412 </macro>
413
414
415 <macro name="search_page_index_record">
416 <n.get_parameter name="i"/>
417 </macro>
418
419 <macro name="search_page_length">
420 12
421 </macro>
422
423 <macro name="search_paging" dot_parameter="do">
424 <n.paging
425 total_rows = "[n.total_posts/]"
426 current_row="[n.search_page_index_record/]"
427 rows_per_page="[n.search_page_length/]"
428 do = "[n.do/]"
429 />
430 </macro>
431
432
433 <macro name="is_all">
434 <n.not.is_author_search/>
435 </macro>
436
437 <macro name="is_author_search">
438 <n.not.is_empty.author_param />
439 </macro>
440
441 <macro name="set_cookies" parameters="did_search">
442 <script type="text/javascript">
443 <n.if.both condition1="[n.not.is_empty.query_param/]" condition2="[n.did_search/]">
444 <then>
445 Nabble.setCookie("query", "<n.javascript_string_encode.query_param/>");
446 Nabble.setCookie("searchterms", "<n.search_terms/>");
447 </then>
448 <else>
449 Nabble.deleteCookie("query");
450 Nabble.deleteCookie("searchterms");
451 </else>
452 </n.if.both>
453 <n.if.is_author_search>
454 <then>
455 Nabble.setCookie("searchuser", "<n.user.search_id/>");
456 </then>
457 <else>
458 Nabble.deleteCookie("searchuser");
459 </else>
460 </n.if.is_author_search>
461 </script>
462 </macro>