Mercurial Hosting > nabble
diff src/nabble/modules/naml/spam_searcher.naml @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/nabble/modules/naml/spam_searcher.naml Thu Mar 21 19:15:52 2019 -0600 @@ -0,0 +1,161 @@ +<namespace name="searcher_tool"/> + +<macro name="searcher" requires="servlet"> + <n.searcher_tool.> + <n.if.not.visitor.is_sysadmin> + <then> + <n.login.><t>Only authorized users can proceed in this area.</t></n.login.> + </then> + </n.if.not.visitor.is_sysadmin> + + <n.if.both condition1="[n.is_submitted_form/]" condition2="[n.not.is_null.get_parameter name='results'/]"> + <then> + <n.get_parameter_values. name="results"> + <n.if.has_more_strings> + <then> + <n.loop.> + <n.if.is_valid_node node_id="[n.current_parameter_value/]"> + <then> + <n.get_node_from_id. node_id="[n.current_parameter_value/]"> + <n.log.>Deleted <n.id/></n.log.> + <n.delete_recursively/> + </n.get_node_from_id.> + </then> + </n.if.is_valid_node> + </n.loop.> + <n.redirect_to.get_parameter name='url'/> + </then> + </n.if.has_more_strings> + </n.get_parameter_values.> + </then> + </n.if.both> + + <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/> + + <script type="text/javascript"> + $(document).ready(function() { + $('div.clickable').each(function() { + var $this = $(this); + var $checkbox = $this.prev().children().eq(0); + $this.click(function() { + var checked = $checkbox.attr('checked'); + if (checked) { + $this.removeClass('info-message'); + $checkbox.removeAttr('checked'); + } else { + $this.addClass('info-message'); + $checkbox.attr('checked', true); + } + }); + }); + }); + function selectAll() { + $('input[type=checkbox]').attr('checked', true).parent().next().addClass('info-message'); + }; + </script> + </head> + <body> + <n.show_search_form/> + <n.show_search_error/> + + <div class="search-results-header"> + <n.if.has_resort> + <then.sort_controls/> + </n.if.has_resort> + + <img src="/images/search.png" class="image16"/> + Found <n.total_posts/> + <n.search_description/> + </div> + + <button onclick="selectAll()">Select all</button> + <n.form.> + <n.results.loop.current_node.> + <div style="margin-bottom:1.5em"> + <div style="margin-bottom:.2em"> + <input type="checkbox" name="results" value="[n.id/]"/> + <n.search_result_topic_subject/> + <n.search_result_post_subject/> + </div> + <div class="clickable"> + <div style="margin-bottom:.2em"> + <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/> + User's Posts: <n.owner.node_count/> + </then> + </n.if.not.is_author_search> + — + <n.topic_node.replies/> replies in thread + </div> + </div> + </div> + </n.results.loop.current_node.> + + <input type="submit" value="Delete Posts Recursively"/> + <input type="hidden" name="url" value="[n.current_url/]"/> + </n.form.> + + <n.search_pagination/> + + <n.if.not.lucene_is_ready> + <then.index_rebuilt_notice/> + </n.if.not.lucene_is_ready> + </body> + </n.html> + </n.node_page.search_namespace.> + </n.searcher_tool.> +</macro> + +<macro name="search_path" parameters="query,author,starrer,days,index_record,sort" requires="node, searcher_tool"> + <n.encode_url.remove_spaces.> + /template/NamlServlet.jtp?macro=searcher&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="starrer" value="[n.starrer/]" /> + <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="search_form" dot_parameter="do" parameters="style,query,author,starrer,days" requires="node,searcher_tool"> + <form style="[n.style/]" action="/template/NamlServlet.jtp"> + <input type="hidden" name="macro" value="searcher" /> + <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="starrer" value="[n.starrer/]" /> + <n.hidden_field name="days" value="[n.days/]" /> + <n.do/> +</form> +</macro> + +<macro name="search_page_length" requires="searcher_tool"> + 100 +</macro> + +<macro name="search_result_message_fragment" requires="node,search,searcher_tool"> + <n.highlight.hide_emails.fragment. size="400"> + <n.message.as_text/> + </n.highlight.hide_emails.fragment.> +</macro> \ No newline at end of file