| 1 | <MTSetVar name="body_class" value="mt-search-results"> |
|---|
| 2 | <MTSetVar name="system_template" value="1"> |
|---|
| 3 | <MTSetVar name="search_results_template" value="1"> |
|---|
| 4 | <MTSetVarBlock name="page_title"><__trans phrase="Search Results"></MTSetVarBlock> |
|---|
| 5 | <MTSetVarBlock name="title"><$MTBlogName encode_html="1"$>: <$MTGetVar name="page_title"$></MTSetVarBlock> |
|---|
| 6 | <MTIfStraightSearch> |
|---|
| 7 | <MTSetVar name="search_type" value="search"> |
|---|
| 8 | <MTElse> |
|---|
| 9 | <MTSetVar name="search_type" value="tag"> |
|---|
| 10 | </MTIfStraightSearch> |
|---|
| 11 | |
|---|
| 12 | <MTSetVarTemplate id="search_results" name="search_results"> |
|---|
| 13 | <div id="search-results"><span id="current-page" class="hidden"><MTCurrentPage></span> |
|---|
| 14 | <MTSearchResults> |
|---|
| 15 | <MTBlogResultHeader> |
|---|
| 16 | <h1 id="page-title" class="search-results-header"> |
|---|
| 17 | <MTIfStraightSearch> |
|---|
| 18 | <__trans phrase="Results matching “[_1]” from [_2]" params="<$MTSearchString$>%%<$MTBlogName encode_html="1"$>"> |
|---|
| 19 | </MTIfStraightSearch> |
|---|
| 20 | <MTIfTagSearch> |
|---|
| 21 | <__trans phrase="Results tagged “[_1]” from [_2]" params="<$MTSearchString$>%%<$MTBlogName encode_html="1"$>"> |
|---|
| 22 | </MTIfTagSearch> |
|---|
| 23 | </h1> |
|---|
| 24 | <div class="search-results-container autopagerize_page_element"> |
|---|
| 25 | </MTBlogResultHeader> |
|---|
| 26 | <$MTInclude module="<__trans phrase="Entry Summary">" hide_counts="1"$> |
|---|
| 27 | <MTBlogResultFooter> |
|---|
| 28 | </div><div class="autopagerize_insert_before"></div> |
|---|
| 29 | </MTBlogResultFooter> |
|---|
| 30 | </MTSearchResults> |
|---|
| 31 | <MTIgnore>Used with the ajax search capability of the new search class</MTIgnore> |
|---|
| 32 | <div class="content-nav"> |
|---|
| 33 | <MTIfPreviousResults><a href="<MTPreviousLink>" rel="prev" onclick="return swapContent(-1);">< <__trans phrase="Previous"></a> </MTIfPreviousResults><MTPagerBlock><MTIfCurrentPage><mt:var name="__value__"><MTElse><a href="<MTPagerLink>"><mt:var name="__value__"></a></MTIfCurrentPage><mt:unless name="__last__"> </mt:unless></MTPagerBlock><MTIfMoreResults> <a href="<MTNextLink>" rel="next" onclick="return swapContent();"><__trans phrase="Next"> ></a></MTIfMoreResults> |
|---|
| 34 | </div> |
|---|
| 35 | </div> |
|---|
| 36 | </MTSetVarTemplate> |
|---|
| 37 | |
|---|
| 38 | <MTIgnore>Used with the ajax search capability of the new search class</MTIgnore> |
|---|
| 39 | <MTSetVarBlock name="html_head" append="1"> |
|---|
| 40 | <script type="text/javascript"> |
|---|
| 41 | <!-- |
|---|
| 42 | <MTIfMoreResults> |
|---|
| 43 | function getXmlHttp() { |
|---|
| 44 | if ( !window.XMLHttpRequest ) { |
|---|
| 45 | window.XMLHttpRequest = function() { |
|---|
| 46 | var types = [ |
|---|
| 47 | "Microsoft.XMLHTTP", |
|---|
| 48 | "MSXML2.XMLHTTP.5.0", |
|---|
| 49 | "MSXML2.XMLHTTP.4.0", |
|---|
| 50 | "MSXML2.XMLHTTP.3.0", |
|---|
| 51 | "MSXML2.XMLHTTP" |
|---|
| 52 | ]; |
|---|
| 53 | |
|---|
| 54 | for ( var i = 0; i < types.length; i++ ) { |
|---|
| 55 | try { |
|---|
| 56 | return new ActiveXObject( types[ i ] ); |
|---|
| 57 | } catch( e ) {} |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | return undefined; |
|---|
| 61 | }; |
|---|
| 62 | } |
|---|
| 63 | if ( window.XMLHttpRequest ) |
|---|
| 64 | return new XMLHttpRequest(); |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | function getResults(page) { |
|---|
| 68 | page = parseInt(page); |
|---|
| 69 | if (timer) window.clearTimeout(timer); |
|---|
| 70 | var xh = getXmlHttp(); |
|---|
| 71 | if (!xh) return false; |
|---|
| 72 | var res = results[page]; |
|---|
| 73 | if (!res) return; |
|---|
| 74 | var url = res['next_url']; |
|---|
| 75 | if (!url) return; |
|---|
| 76 | |
|---|
| 77 | xh.open('GET', url + '&format=js', true); |
|---|
| 78 | xh.onreadystatechange = function() { |
|---|
| 79 | if ( xh.readyState == 4 ) { |
|---|
| 80 | if ( xh.status && ( xh.status != 200 ) ) { |
|---|
| 81 | // error - ignore |
|---|
| 82 | } else { |
|---|
| 83 | try { |
|---|
| 84 | var page_results = eval("(" + xh.responseText + ")"); |
|---|
| 85 | if ( page_results['error'] == null ) |
|---|
| 86 | results[page + 1] = page_results['result']; |
|---|
| 87 | } catch (e) { |
|---|
| 88 | } |
|---|
| 89 | } |
|---|
| 90 | } |
|---|
| 91 | }; |
|---|
| 92 | xh.send(null); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | function swapContent(direction) { |
|---|
| 96 | if ( direction == undefined ) direction = 1; |
|---|
| 97 | var page_span = document.getElementById('current-page'); |
|---|
| 98 | if (!page_span) return true; |
|---|
| 99 | var next_page = direction + parseInt(page_span.innerHTML); |
|---|
| 100 | var res = results[next_page]; |
|---|
| 101 | if (!res) return true; |
|---|
| 102 | var content = res['content']; |
|---|
| 103 | if (!content) return true; |
|---|
| 104 | var div = document.getElementById('search-results'); |
|---|
| 105 | if (!div) return true; |
|---|
| 106 | div.innerHTML = content; |
|---|
| 107 | timer = window.setTimeout("getResults(" + next_page + ")", 1*1000); |
|---|
| 108 | window.scroll(0, 0); |
|---|
| 109 | return false; |
|---|
| 110 | } |
|---|
| 111 | <MTElse><MTIfPreviousResults> |
|---|
| 112 | function swapContent(direction) { |
|---|
| 113 | return true; |
|---|
| 114 | }</MTIfPreviousResults> |
|---|
| 115 | </MTIfMoreResults> |
|---|
| 116 | //--> |
|---|
| 117 | </script> |
|---|
| 118 | </MTSetVarBlock> |
|---|
| 119 | |
|---|
| 120 | <$MTInclude module="<__trans phrase="Header">"$> |
|---|
| 121 | |
|---|
| 122 | <$MTVar name="search_results"$> |
|---|
| 123 | |
|---|
| 124 | <MTNoSearchResults> |
|---|
| 125 | <h1 id="page-title" class="search-results-header"> |
|---|
| 126 | <MTIfStraightSearch> |
|---|
| 127 | <__trans phrase="Results matching “[_1]”" params="<$MTSearchString$>"> |
|---|
| 128 | </MTIfStraightSearch> |
|---|
| 129 | <MTIfTagSearch> |
|---|
| 130 | <__trans phrase="Results tagged “[_1]”" params="<$MTSearchString$>"> |
|---|
| 131 | </MTIfTagSearch> |
|---|
| 132 | </h1> |
|---|
| 133 | <p><__trans phrase="No results found for “[_1]”." params="<$MTSearchString$>"></p> |
|---|
| 134 | </MTNoSearchResults> |
|---|
| 135 | |
|---|
| 136 | <MTNoSearch> |
|---|
| 137 | <h1 id="page-title" class="search-results-header"><__trans phrase="Instructions"></h1> |
|---|
| 138 | <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> |
|---|
| 139 | <blockquote> |
|---|
| 140 | <p><code>"<__trans phrase="movable type">"</code></p> |
|---|
| 141 | </blockquote> |
|---|
| 142 | <p><__trans phrase="The search engine also supports AND, OR, and NOT keywords to specify boolean expressions:"></p> |
|---|
| 143 | <blockquote> |
|---|
| 144 | <p><code><__trans phrase="personal OR publishing"></code></p> |
|---|
| 145 | <p><code><__trans phrase="publishing NOT personal"></code></p> |
|---|
| 146 | </blockquote> |
|---|
| 147 | </MTNoSearch> |
|---|
| 148 | |
|---|
| 149 | <MTIgnore>Used with the ajax search capability of the new search class</MTIgnore> |
|---|
| 150 | <MTIfMoreResults> |
|---|
| 151 | <script type="text/javascript"> |
|---|
| 152 | <!-- |
|---|
| 153 | var div = document.getElementById('search-results'); |
|---|
| 154 | var results = { |
|---|
| 155 | '<MTCurrentPage>': { |
|---|
| 156 | 'content': div.innerHTML, |
|---|
| 157 | 'next_url': '<MTNextLink>' |
|---|
| 158 | } |
|---|
| 159 | }; |
|---|
| 160 | var timer = window.setTimeout("getResults(" + <MTCurrentPage> + ")", 1*1000); |
|---|
| 161 | //--> |
|---|
| 162 | </script> |
|---|
| 163 | </MTIfMoreResults> |
|---|
| 164 | <$MTInclude module="<__trans phrase="Footer">"$> |
|---|