root/branches/release-38/default_templates/search_results.mtml @ 2310

Revision 2310, 7.1 kB (checked in by bsmith, 19 months ago)

bugzid:79732 - Add captcha to comment prevew

  • Property svn:keywords set to Id Revision
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4<head>
5    <$mt:include module="<__trans phrase="HTML Head">"$>
6    <title><$MTBlogName encode_html="1"$>: <__trans phrase="Search Results"></title>
7    <MTIgnore>Below Javascript adds ajax search capability</MTIgnore>
8    <script type="text/javascript">
9    /* <![CDATA[ */
10    <MTIfMoreResults>
11    function getResults(page) {
12        page = parseInt(page);
13        if (timer) window.clearTimeout(timer);
14        var xh = mtGetXmlHttp();
15        if (!xh) return false;
16        var res = results[page];
17        if (!res) return;
18        var url = res['next_url'];
19        if (!url) return;
20
21        xh.open('GET', url + '&format=js', true);
22        xh.onreadystatechange = function() {
23            if ( xh.readyState == 4 ) {
24                if ( xh.status && ( xh.status != 200 ) ) {
25                    // error - ignore
26                } else {
27                    try {
28                        var page_results = eval("(" + xh.responseText + ")");
29                        if ( page_results['error'] == null )
30                            results[page + 1] = page_results['result'];
31                    } catch (e) {
32                    }
33                }
34            }
35        };
36        xh.send(null);
37    }
38
39    function swapContent(direction) {
40        if ( direction == undefined ) direction = 1;
41        var page_span = document.getElementById('current-page');
42        if (!page_span) return true;
43        var next_page = direction + parseInt(page_span.innerHTML);
44        var res = results[next_page];
45        if (!res) return true;
46        var content = res['content'];
47        if (!content) return true;
48        var div = document.getElementById('search-results');
49        if (!div) return true;
50        div.innerHTML = content;
51        timer = window.setTimeout("getResults(" + next_page + ")", 1*1000);
52        window.scroll(0, 0);
53        return false;
54    }
55    <MTElse><MTIfPreviousResults>
56    function swapContent(direction) {
57        return true;
58    }</MTIfPreviousResults>
59    </MTIfMoreResults>
60    /* ]]> */
61    </script>
62</head>
63<body id="<$mt:BlogTemplateSetID$>" class="mt-search-results <$MTVar name="page_layout"$>">
64    <div id="container">
65        <div id="container-inner">
66
67
68            <$mt:include module="<__trans phrase="Banner Header">"$>
69
70
71            <div id="content">
72                <div id="content-inner">
73
74
75                    <div id="alpha">
76                        <div id="alpha-inner">
77
78<mt:ignore><!--
79    Below is the block to show search results.
80    This makes an independent block to support
81    Ajax-based background retrieval of the next search results.
82--></mt:ignore>
83<MTSetVarTemplate id="search_results" name="search_results"> 
84<MTSearchResults>
85    <MTSearchResultsHeader>
86                            <div id="search-results">
87                                <span id="current-page" class="hidden"><MTCurrentPage></span>
88                                <h1 id="page-title" class="search-results-header">
89        <MTIfStraightSearch>
90                                    <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
91        </MTIfStraightSearch>
92        <MTIfTagSearch>
93                                    <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
94        </MTIfTagSearch>
95                                </h1>
96                                <div class="search-results-container autopagerize_page_element">
97    </MTSearchResultsHeader>
98                                    <$MTInclude module="<__trans phrase="Entry Summary">" hide_counts="1"$>
99    <MTSearchResultsFooter>
100                                </div><div class="autopagerize_insert_before"></div>
101
102    <MTIgnore><!-- Used with the ajax search capability of the new search class --></MTIgnore>
103                                <div class="content-nav">
104                                    <MTIfPreviousResults><a href="<MTPreviousLink>" rel="prev" onclick="return swapContent(-1);">&lt; <__trans phrase="Previous"></a>&nbsp;&nbsp;</MTIfPreviousResults><MTPagerBlock><MTIfCurrentPage><MTVar name="__value__"><MTElse><a href="<MTPagerLink>"><MTVar name="__value__"></a></MTIfCurrentPage><mt:unless name="__last__">&nbsp;</mt:unless></MTPagerBlock><MTIfMoreResults>&nbsp;&nbsp;<a href="<MTNextLink>" rel="next" onclick="return swapContent();"><__trans phrase="Next"> &gt;</a></MTIfMoreResults>
105                                </div>
106                            </div>
107    </MTSearchResultsFooter>
108</MTSearchResults>
109</MTSetVarTemplate>
110<mt:ignore><!-- Display search results constructed in the block above --></mt:ignore>
111<mt:var name="search_results">
112
113
114<mt:ignore><!-- Display no results message --></mt:ignore>
115<MTNoSearchResults>
116                            <h1 id="page-title" class="search-results-header">
117    <MTIfStraightSearch>
118                                <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
119    </MTIfStraightSearch>
120    <MTIfTagSearch>
121                                <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
122    </MTIfTagSearch>
123                            </h1>
124                            <p><__trans phrase="No results found for &ldquo;[_1]&rdquo;." params="<$MTSearchString$>"></p>
125</MTNoSearchResults>
126
127
128<mt:ignore><!-- Display instructions for searching if search script was accessed without a query --></mt:ignore>
129<MTNoSearch>
130                            <h1 id="page-title" class="search-results-header"><__trans phrase="Instructions"></h1>
131                            <p><__trans phrase="By default, this search engine looks for all words in any order. To search for an exact phrase, enclose the phrase in quotes:"></p>
132                            <blockquote>
133                                <p><code>"<__trans phrase="movable type">"</code></p>
134                            </blockquote>
135                            <p><__trans phrase="The search engine also supports AND, OR, and NOT keywords to specify boolean expressions:"></p>
136                            <blockquote>
137                                <p><code><__trans phrase="personal OR publishing"></code></p>
138                                <p><code><__trans phrase="publishing NOT personal"></code></p>
139                            </blockquote>
140</MTNoSearch>
141
142<MTIgnore><!-- Used with the ajax search capability of the new search class --></MTIgnore>
143<MTIfMoreResults>
144<script type="text/javascript">
145<!--
146var div = document.getElementById('search-results');
147var results = {
148    '<MTCurrentPage>': {
149        'content': div.innerHTML,
150        'next_url': '<MTNextLink>'
151    }
152};
153var timer = window.setTimeout("getResults(" + <MTCurrentPage> + ")", 1*1000);
154//-->
155</script>
156</MTIfMoreResults>
157
158
159                        </div>
160                    </div>
161
162                    <$MTInclude module="<__trans phrase="Sidebar">"$>
163
164
165                </div>
166            </div>
167
168
169            <$mt:include module="<__trans phrase="Banner Footer">"$>
170
171
172        </div>
173    </div>
174</body>
175</html>
Note: See TracBrowser for help on using the browser.