PageRenderTime 16ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/search.aspx

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