Mercurial Hosting > nabble
view src/nabble/view/naml/search.naml @ 62:4674ed7d56df default tip
remove n2
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 30 Sep 2023 20:25:29 -0600 |
parents | 7ecd1a4ef557 |
children |
line wrap: on
line source
<macro name="search_page" requires="servlet"> <n.search_page_html/> </macro> <macro name="search_page_html" requires="servlet"> <n.define_search_query_field/> <n.node_page.search_namespace.> <n.set_var name='didSearch' value="false" /> <n.catch_exception. id="search-block"> <n.do_search_using_params /> <n.set_var name='didSearch' value="true" /> </n.catch_exception.> <n.html> <head> <meta name="robots" content="noindex,nofollow"/> <n.search_page_title/> <n.set_cookies did_search="[n.var name='didSearch'/]" /> <n.search_page_style/> </head> <body> <n.show_search_form/> <n.show_search_error/> <n.search_results_header/> <n.results.loop.current_node.> <n.search_result_row/> </n.results.loop.current_node.> <n.search_pagination/> <n.if.not.lucene_is_ready> <then.index_rebuilt_notice/> </n.if.not.lucene_is_ready> <n.if.has_results> <then.show_search_form/> </n.if.has_results> </body> </n.html> </n.node_page.search_namespace.> </macro> <macro name="search_page_title" requires="search"> <n.title.> <n.case_all.>Search for '<n.search_query_field.value/>'</n.case_all.> <n.case_author_search.>Messages of <n.user.name/></n.case_author_search.> </n.title.> </macro> <macro name="search_page_style" requires="search"> <style type="text/css"> .nabble td.verbose-search-box { text-align: left; padding-top: .33em; padding-bottom: .33em; padding-left: .17em; } div.search-results-header { margin:2em 0 1em; font-size:90%; } </style> </macro> <macro name="search_results_header" requires="search"> <div class="search-results-header"> <n.if.has_resort> <then> <n.sort_controls/> </then> </n.if.has_resort> <img src="/images/search.png" class="image16"/> Found <n.total_posts/> <n.search_description/> </div> </macro> <macro name="search_result_row" requires="node,search"> <div style="margin-bottom:1.5em"> <div style="margin-bottom:.2em" class="adbayes-content"> <n.search_result_topic_subject/> <n.search_result_post_subject/> </div> <div style="margin-bottom:.2em" class="adbayes-content"> <n.search_result_message_fragment/> </div> <div class="weak-color" style="font-size:80%"> <n.search_result_in_app/> <n.search_result_on_date/> <n.if.not.is_author_search> <then> by <n.owner.user_link/> </then> </n.if.not.is_author_search> — <n.topic_node.replies/> replies in thread </div> </div> </macro> <macro name="search_result_topic_subject" requires="node,search"> <span class="second-font big-title"> <n.node_link text="[n.highlight.topic_node.subject/]" /> </span> </macro> <macro name="search_result_post_subject" requires="node,search"> <n.if.not.regex_matches pattern=".*[n.regex_quote.topic_node.subject/]" text="[n.subject/]"> <then> (<n.highlight.subject/>)</then> </n.if.not.regex_matches> </macro> <macro name="search_result_message_fragment" requires="node,search"> <n.highlight.hide_emails.fragment. size="300"> <n.message.as_text/> </n.highlight.hide_emails.fragment.> </macro> <macro name="search_result_in_app" requires="node,search"> <n.if.is_in_app> <then> in <n.get_app_node.><n.node_link text="[n.highlight.subject/]" /></n.get_app_node.> </then> </n.if.is_in_app> </macro> <macro name="search_result_on_date" requires="node,search"> <script type="text/javascript"> Nabble.postDate = new Date(<n.when_created.raw_time/>); document.write(Nabble.isToday(Nabble.postDate) ? " at " : " on "); document.write(Nabble.formatDateShort(Nabble.postDate)); </script> </macro> <macro name="search_pagination" requires="search"> <n.search_paging.> <n.if.has_paging> <then> <div style="font-size:90%;text-align:right;margin-bottom:1em"> <n.if.has_previous_page> <then> <a href="[n.previous_page_path/]">« Prev <n.rows_per_page/></a> <n.if.has_next_page> <then> - </then> </n.if.has_next_page> </then> </n.if.has_previous_page> <n.if.has_next_page> <then> <a href="[n.next_page_path/]">Next <n.rows_per_page/> »</a> </then> </n.if.has_next_page> </div> </then> </n.if.has_paging> </n.search_paging.> </macro> <macro name="index_rebuilt_notice" requires="search"> <div class="info-message rounded" style="text-align:center;padding:.5em;margin:.5em 0"> <t><b>Warning:</b> The search index is currently being rebuilt. Search results may be incomplete.</t> </div> </macro> <macro name="sort_controls" requires="search"> <div style="float:right;margin:0 1em"> <n.if.sorted_by_date> <then> <a href="[n.sort_by_relevance_path/]"><t>Sort by relevance</t></a> | <t>Sorted by date</t> </then> <else> <t>Sorted by relevance</t> | <a href="[n.sort_by_date_path/]"><t>Sort by date</t></a> </else> </n.if.sorted_by_date> </div> </macro> <macro name="search_description" requires="search"> <n.if.has_query> <then>matching posts for <b><n.search_query_field.value/></b></then> <else>posts</else> </n.if.has_query> in <n.page_node.node_link/> <n.case_author_search.> by <n.user.user_link/> </n.case_author_search.> <n.if.has_days> <then>within <n.days/> days</then> </n.if.has_days> <n.search_paging.> <n.if.has_paging> <then>Showing posts <n.current_page.page_row.plus.one/> to <n.current_page.page_row.plus.rows_per_page/>.</then> </n.if.has_paging> </n.search_paging.> </macro> <macro name="show_search_error" requires="search"> <n.format_error.handle_exception. for="search-block"> <n.exception. name="search_query_parse_error"> This query is invalid. <br/>For more information, read about <a href="http://lucene.apache.org/java/2_4_1/queryparsersyntax.html">Lucene query parser syntax</a> </n.exception.> <n.exception. name="too_many_search_clauses"> Your search will give too many matches. </n.exception.> </n.format_error.handle_exception.> </macro> <macro name="show_search_form" requires="search"> <div class="shaded-bg-color rounded"> <n.page_node.search_form.> <table> <tr> <td class="verbose-search-box"> <style type="text/css"> div.field-title { margin-top: 0; } </style> <div class="second-font field-title">Search</div> <n.case_author_search.> <select name="author"> <option value="[n.author_param/]" selected="true">posts by '<n.user.name/>'</option> <option value="">all posts</option> </select> </n.case_author_search.> <n.search_query_field.input size="40" /> <select name="days"> <n.if.not.contains_substring string="-0-1-7-30-90-180-365-" substring="-[n.days/]-"> <then> <n.days_option. value="[n.days/]">past <n.days/> days</n.days_option.> </then> </n.if.not.contains_substring> <n.days_option. value="0">all dates</n.days_option.> <n.days_option. value="1">past 24 hours</n.days_option.> <n.days_option. value="7">past week</n.days_option.> <n.days_option. value="30">past month</n.days_option.> <n.days_option. value="90">past 3 months</n.days_option.> <n.days_option. value="180">past 6 months</n.days_option.> <n.days_option. value="365">past year</n.days_option.> </select> <input type="submit" value="Go »" /> </td> <td style="font-size:90%;padding:0 0 .3em 1em;vertical-align:bottom"> <div style="margin-bottom:.4em"> <a href="[n.advanced_search_path_using_params/]">Advanced Search</a> </div> <a href="[n.help.search.url/]">Show Tips</a> </td> </tr> </table> </n.page_node.search_form.> </div> </macro> <macro name="case_all" requires="search" dot_parameter="do"> <n.if.is_all> <then><n.do/></then> </n.if.is_all> </macro> <macro name="case_author_search" requires="search" dot_parameter="do"> <n.if.is_author_search> <then><n.do/></then> </n.if.is_author_search> </macro> <macro name="days_option" requires="search" parameters="value" dot_parameter="text"> <n.option. value="[n.value/]" selected="[n.days/]"><n.text/></n.option.> </macro> <macro name="option" parameters="value,selected" dot_parameter="text"> <n.if.equal value1="[n.value/]" value2="[n.selected/]"> <then> <option value="[n.value/]" selected="true"><n.text/></option> </then> <else> <option value="[n.value/]"><n.text/></option> </else> </n.if.equal> </macro> <macro name="define_search_query_field"> <n.if.not.is_null.search_query_field.value> <then> <n.search_query_field.set_value.> <n.regex_replace_all. pattern="\band\b" replacement="AND"> <n.regex_replace_all. pattern="\bor\b" replacement="OR"> <n.trim.search_query_field.value/> </n.regex_replace_all.> </n.regex_replace_all.> </n.search_query_field.set_value.> </then> </n.if.not.is_null.search_query_field.value> </macro> <macro name="search_query_field" dot_parameter="do"> <n.field. name="query"><n.do/></n.field.> </macro> <macro name="do_search_using_params" requires="search"> <n.if.not.is_empty.author_param> <then.query_author.author_param/> </n.if.not.is_empty.author_param> <n.do_search length="[n.search_page_length/]" query="[n.query_param/]" days="[n.get_parameter name='days'/]" start="[n.search_page_index_record/]" sort="[n.get_parameter name='sort'/]" /> </macro> <macro name="author_param"> <n.get_parameter name='author'/> </macro> <macro name="query_param"> <n.get_parameter name='query'/> </macro> <macro name="previous_page_path" requires="paging,search"> <n.search_path_using_params index_record="[n.previous_page.page_row/]" /> </macro> <macro name="next_page_path" requires="paging,search"> <n.search_path_using_params index_record="[n.next_page.page_row/]" /> </macro> <macro name="sort_by_relevance_path"> <n.search_path_using_params sort="relevance" index_record="0" /> </macro> <macro name="sort_by_date_path"> <n.search_path_using_params sort="date" index_record="0" /> </macro> <macro name="search_path_using_params" parameters="query,author,days,index_record,sort" requires="node_page,servlet"> <n.page_node.> <n.search_path> <query><n.default_to_param name="query" value="[n.query/]" /></query> <author><n.default_to_param name="author" value="[n.author/]" /></author> <days><n.default_to_param name="days" value="[n.days/]" /></days> <index_record><n.default_to_param name="index_record" value="[n.index_record/]" /></index_record> <sort><n.default_to_param name="sort" value="[n.sort/]" /></sort> </n.search_path> </n.page_node.> </macro> <macro name="default_to_param" parameters="name" dot_parameter="value"> <n.default> <text><n.value/></text> <to><n.get_parameter name="[n.name/]"/></to> </n.default> </macro> <macro name="search_path" parameters="query,author,days,index_record,sort" requires="node"> <n.encode_url.remove_spaces.> /template/NamlServlet.jtp?macro=search_page&node=<n.id/> <n.add_to_path name="query" value="[n.query/]" /> <n.add_to_path name="author" value="[n.author/]" /> <n.add_to_path name="days" value="[n.days/]" /> <n.add_to_path name="i" value="[n.index_record/]" default_value="0" /> <n.add_to_path name="sort" value="[n.sort/]" default_value="relevance" /> </n.encode_url.remove_spaces.> </macro> <macro name="page_search_box" parameters="author" requires="node,servlet"> <n.search_form. style="display: inline; margin: 0;" author="[n.author/]" > <input id="nabble.searchQuery" type="text" class="medium-border-color" name="query" size="20" /> </n.search_form.> </macro> <macro name="search_form" dot_parameter="do" parameters="style,query,author,days" requires="node"> <form style="[n.style/]" action="/template/NamlServlet.jtp"> <input type="hidden" name="macro" value="search_page" /> <input type="hidden" name="node" value="[n.id/]" /> <n.hidden_field name="query" value="[n.query/]" /> <n.hidden_field name="author" value="[n.author/]" /> <n.hidden_field name="days" value="[n.days/]" /> <n.do/> </form> </macro> <macro name="hidden_field" parameters="name,default_value" dot_parameter="value"> <n.if.not.is_null.value> <then> <n.if.not.equal value1="[n.value/]" value2="[n.default_value/]"> <then> <input type='hidden' name="[n.name/]" value="[n.value/]"/> </then> </n.if.not.equal> </then> </n.if.not.is_null.value> </macro> <macro name="advanced_search_path_using_params" parameters="days" requires="node"> <n.advanced_search_path> <days><n.default_to_param name="days" value="[n.days/]" /></days> </n.advanced_search_path> </macro> <macro name="advanced_search_path" parameters="days" requires="node"> <n.encode_url.remove_spaces.> /template/NamlServlet.jtp?macro=adv_search_page&node=<n.id/> <n.add_to_path name="days" value="[n.days/]" /> </n.encode_url.remove_spaces.> </macro> <macro name="search_page_index_record"> <n.get_parameter name="i"/> </macro> <macro name="search_page_length"> 12 </macro> <macro name="search_paging" dot_parameter="do"> <n.paging total_rows = "[n.total_posts/]" current_row="[n.search_page_index_record/]" rows_per_page="[n.search_page_length/]" do = "[n.do/]" /> </macro> <macro name="is_all"> <n.not.is_author_search/> </macro> <macro name="is_author_search"> <n.not.is_empty.author_param /> </macro> <macro name="set_cookies" parameters="did_search"> <script type="text/javascript"> <n.if.both condition1="[n.not.is_empty.query_param/]" condition2="[n.did_search/]"> <then> Nabble.setCookie("query", "<n.javascript_string_encode.query_param/>"); Nabble.setCookie("searchterms", "<n.search_terms/>"); </then> <else> Nabble.deleteCookie("query"); Nabble.deleteCookie("searchterms"); </else> </n.if.both> <n.if.is_author_search> <then> Nabble.setCookie("searchuser", "<n.user.search_id/>"); </then> <else> Nabble.deleteCookie("searchuser"); </else> </n.if.is_author_search> </script> </macro>