root/branches/release-39/default_templates/search_results.mtml @ 2463

Revision 2463, 7.2 kB (checked in by bchoate, 18 months ago)

Updates to optimize recently_commented_on, category and tag attributes for Entries tag - BugId:79914. Search app can now supply user state - BugId:79906. Fix for 2-digit year bug - BugId:79924

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