PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/search.aspx

#
ASP.NET | 55 lines | 46 code | 9 blank | 0 comment | 6 complexity | ebdaa7a4d89fb57df0ca3f52b08b65bd MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. <%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" Inherits="search" ValidateRequest="false" Codebehind="search.aspx.cs" %>
  2. <%@ Import Namespace="BlogEngine.Core" %>
  3. <asp:content id="Content1" contentplaceholderid="cphBody" runat="Server">
  4. <div class="searchpage post search-page page-global">
  5. <h2 runat="server" class="page-global-title" id="h1Headline" />
  6. <div id="searchpage" class="search-page-searchbox clearfix">
  7. <input type="text" name="q" id="q" value="<%=Server.HtmlEncode(Request.QueryString["q"]) %>" onkeypress="if(event.keyCode==13) SearchPage()" />
  8. <input type="button" value="<%=Resources.labels.search %>" class="btn btn-primary" onclick="SearchPage()" onkeypress="SearchPage()" />
  9. <% if (BlogSettings.Instance.EnableCommentSearch && BlogSettings.Instance.ShowIncludeCommentsOption)
  10. { %>
  11. <input type="checkbox" name="comment" id="comment" /><label for="comment"><%=BlogSettings.Instance.SearchCommentLabelText %></label>
  12. <%} %>
  13. </div>
  14. <script type="text/javascript">
  15. //<![CDATA[
  16. var check = document.getElementById('comment');
  17. function SearchPage()
  18. {
  19. var searchTerm = encodeURIComponent(document.getElementById('q').value);
  20. var include = check ? check.checked : false;
  21. var comment = '&comment=true';
  22. if (!include)
  23. {
  24. comment = ''
  25. }
  26. location.href = 'search<%= BlogConfig.FileExtension %>?q=' + searchTerm + comment;
  27. }
  28. if (check != null)
  29. {
  30. check.checked = <%=(Request.QueryString["comment"] != null).ToString().ToLowerInvariant() %>;
  31. }
  32. //]]>
  33. </script>
  34. <asp:repeater runat="server" id="rep">
  35. <ItemTemplate>
  36. <div class="searchresult">
  37. <a href="<%# Eval("AbsoluteLink") %>"><%# Eval("Title") %></a>
  38. <span class="text"><%# GetContent((string)Eval("Description"), (string)Eval("Content")) %></span>
  39. <span class="type" runat="server" id="type" />
  40. <span class="url"><%# ShortenUrl(Eval("AbsoluteLink").ToString())%></span>
  41. </div>
  42. </ItemTemplate>
  43. </asp:repeater>
  44. <asp:PlaceHolder ID="Paging" runat="server" />
  45. </div>
  46. </asp:content>