root/branches/release-36/default_templates/search_results.mtml @ 2062

Revision 2062, 7.2 kB (checked in by bchoate, 19 months ago)

Updates to blog-side javascript regarding user state and permissions. BugId:79077,69644,67754,69814,79258,62643. Fixed declarations for conditional tags. BugId:79476. Display auth'd user nickname rather than name from comment object. BugId:79475

  • 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    <title><$MTBlogName encode_html="1"$>: <__trans phrase="Search Results"></title>
6    <$mt:include module="<__trans phrase="HTML Head">"$>
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    <script type="text/javascript" src="<$MTLink template="javascript"$>"></script>
63</head>
64<body id="<$mt:BlogTemplateSetID$>" class="mt-search-results <$MTVar name="page_layout"$>">
65    <div id="container">
66        <div id="container-inner">
67
68
69            <$mt:include module="<__trans phrase="Banner Header">"$>
70
71
72            <div id="content">
73                <div id="content-inner">
74
75
76                    <div id="alpha">
77                        <div id="alpha-inner">
78
79<mt:ignore><!--
80    Below is the block to show search results.
81    This makes an independent block to support
82    Ajax-based background retrieval of the next search results.
83--></mt:ignore>
84<MTSetVarTemplate id="search_results" name="search_results"> 
85<MTSearchResults>
86    <MTSearchResultsHeader>
87                            <div id="search-results">
88                                <span id="current-page" class="hidden"><MTCurrentPage></span>
89                                <h1 id="page-title" class="search-results-header">
90        <MTIfStraightSearch>
91                                    <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
92        </MTIfStraightSearch>
93        <MTIfTagSearch>
94                                    <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
95        </MTIfTagSearch>
96                                </h1>
97                                <div class="search-results-container autopagerize_page_element">
98    </MTSearchResultsHeader>
99                                    <$MTInclude module="<__trans phrase="Entry Summary">" hide_counts="1"$>
100    <MTSearchResultsFooter>
101                                </div><div class="autopagerize_insert_before"></div>
102
103    <MTIgnore><!-- Used with the ajax search capability of the new search class --></MTIgnore>
104                                <div class="content-nav">
105                                    <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>
106                                </div>
107                            </div>
108    </MTSearchResultsFooter>
109</MTSearchResults>
110</MTSetVarTemplate>
111<mt:ignore><!-- Display search results constructed in the block above --></mt:ignore>
112<mt:var name="search_results">
113
114
115<mt:ignore><!-- Display no results message --></mt:ignore>
116<MTNoSearchResults>
117                            <h1 id="page-title" class="search-results-header">
118    <MTIfStraightSearch>
119                                <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
120    </MTIfStraightSearch>
121    <MTIfTagSearch>
122                                <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$MTSearchString$>">
123    </MTIfTagSearch>
124                            </h1>
125                            <p><__trans phrase="No results found for &ldquo;[_1]&rdquo;." params="<$MTSearchString$>"></p>
126</MTNoSearchResults>
127
128
129<mt:ignore><!-- Display instructions for searching if search script was accessed without a query --></mt:ignore>
130<MTNoSearch>
131                            <h1 id="page-title" class="search-results-header"><__trans phrase="Instructions"></h1>
132                            <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>
133                            <blockquote>
134                                <p><code>"<__trans phrase="movable type">"</code></p>
135                            </blockquote>
136                            <p><__trans phrase="The search engine also supports AND, OR, and NOT keywords to specify boolean expressions:"></p>
137                            <blockquote>
138                                <p><code><__trans phrase="personal OR publishing"></code></p>
139                                <p><code><__trans phrase="publishing NOT personal"></code></p>
140                            </blockquote>
141</MTNoSearch>
142
143<MTIgnore><!-- Used with the ajax search capability of the new search class --></MTIgnore>
144<MTIfMoreResults>
145<script type="text/javascript">
146<!--
147var div = document.getElementById('search-results');
148var results = {
149    '<MTCurrentPage>': {
150        'content': div.innerHTML,
151        'next_url': '<MTNextLink>'
152    }
153};
154var timer = window.setTimeout("getResults(" + <MTCurrentPage> + ")", 1*1000);
155//-->
156</script>
157</MTIfMoreResults>
158
159
160                        </div>
161                    </div>
162
163                    <$MTInclude module="<__trans phrase="Sidebar">"$>
164
165
166                </div>
167            </div>
168
169
170            <$mt:include module="<__trans phrase="Banner Footer">"$>
171
172
173        </div>
174    </div>
175</body>
176</html>
Note: See TracBrowser for help on using the browser.