Index: trunk/phase3/skins/monobook/main.css |
— | — | @@ -1446,6 +1446,13 @@ |
1447 | 1447 | content: "\00BB \0020"; |
1448 | 1448 | } |
1449 | 1449 | |
| 1450 | +div#searchTargetHide { |
| 1451 | + float:right; |
| 1452 | + border:solid 1px black; |
| 1453 | + background:gainsboro; |
| 1454 | + padding:2px; |
| 1455 | +} |
| 1456 | + |
1450 | 1457 | div.multipageimagenavbox { |
1451 | 1458 | border: solid 1px silver; |
1452 | 1459 | padding: 4px; |
Index: trunk/phase3/includes/AjaxFunctions.php |
— | — | @@ -74,60 +74,78 @@ |
75 | 75 | } |
76 | 76 | |
77 | 77 | function wfSajaxSearch( $term ) { |
78 | | - global $wgContLang, $wgOut; |
| 78 | + global $wgContLang, $wgOut, $wgUser; |
79 | 79 | $limit = 16; |
| 80 | + $sk = $wgUser->getSkin(); |
80 | 81 | |
81 | | - $l = new Linker; |
82 | | - |
83 | 82 | $term = trim( $term ); |
84 | 83 | $term = str_replace( ' ', '_', $wgContLang->ucfirst( |
85 | 84 | $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ) |
86 | 85 | ) ); |
| 86 | + $term_title = Title::newFromText( $term ); |
87 | 87 | |
88 | | - if ( strlen( str_replace( '_', '', $term ) )<3 ) |
89 | | - return; |
| 88 | + $r = $more = ''; |
| 89 | + $canSearch = true; |
| 90 | + if( $term_title && $term_title->getNamespace() != NS_SPECIAL ) { |
| 91 | + $db = wfGetDB( DB_SLAVE ); |
| 92 | + $res = $db->select( 'page', array( 'page_title', 'page_namespace' ), |
| 93 | + array( 'page_namespace' => $term_title->getNamespace(), |
| 94 | + "page_title LIKE '". $db->strencode( $term_title->getDBKey() ) ."%'" ), |
| 95 | + "wfSajaxSearch", |
| 96 | + array( 'LIMIT' => $limit+1 ) |
| 97 | + ); |
90 | 98 | |
91 | | - $db = wfGetDB( DB_SLAVE ); |
92 | | - $res = $db->select( 'page', 'page_title', |
93 | | - array( 'page_namespace' => 0, |
94 | | - "page_title LIKE '". $db->strencode( $term) ."%'" ), |
95 | | - "wfSajaxSearch", |
96 | | - array( 'LIMIT' => $limit+1 ) |
97 | | - ); |
| 99 | + $i = 0; |
| 100 | + while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) { |
| 101 | + $nt = Title::newFromText( $row->page_title, $row->page_namespace ); |
| 102 | + $r .= '<li>' . $sk->makeKnownLinkObj( $nt ) . "</li>\n"; |
| 103 | + } |
| 104 | + if ( $i > $limit ) { |
| 105 | + $more = '<i>' . $sk->makeKnownLink( $wgContLang->specialPage( "Allpages" ), |
| 106 | + wfMsg('moredotdotdot'), |
| 107 | + "namespace=0&from=" . wfUrlEncode ( $term ) ) . |
| 108 | + '</i>'; |
| 109 | + } |
| 110 | + } else if( $term_title && $term_title->getNamespace() == NS_SPECIAL ) { |
| 111 | + SpecialPage::initList(); |
| 112 | + SpecialPage::initAliasList(); |
| 113 | + $specialPages = array_merge( |
| 114 | + array_keys( SpecialPage::$mList ), |
| 115 | + array_keys( SpecialPage::$mAliases ) |
| 116 | + ); |
98 | 117 | |
99 | | - $r = ""; |
| 118 | + foreach( $specialPages as $page ) { |
| 119 | + if( $wgContLang->uc( $page ) != $page && strpos( $page, $term_title->getText() ) === 0 ) { |
| 120 | + $r .= '<li>' . $sk->makeKnownLinkObj( Title::newFromText( $page, NS_SPECIAL ) ) . '</li>'; |
| 121 | + } |
| 122 | + } |
100 | 123 | |
101 | | - $i=0; |
102 | | - while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) { |
103 | | - $nt = Title::newFromDBkey( $row->page_title ); |
104 | | - $r .= '<li>' . $l->makeKnownLinkObj( $nt ) . "</li>\n"; |
| 124 | + $canSearch = false; |
105 | 125 | } |
106 | | - if ( $i > $limit ) { |
107 | | - $more = '<i>' . $l->makeKnownLink( $wgContLang->specialPage( "Allpages" ), |
108 | | - wfMsg('moredotdotdot'), |
109 | | - "namespace=0&from=" . wfUrlEncode ( $term ) ) . |
110 | | - '</i>'; |
111 | | - } else { |
112 | | - $more = ''; |
113 | | - } |
114 | 126 | |
115 | | - $subtitlemsg = ( Title::newFromText($term) ? 'searchsubtitle' : 'searchsubtitleinvalid' ); |
116 | | - $subtitle = $wgOut->parse( wfMsg( $subtitlemsg, wfEscapeWikiText($term) ) ); #FIXME: parser is missing mTitle ! |
117 | | - |
| 127 | + $valid = (bool) $term_title; |
118 | 128 | $term_url = urlencode( $term ); |
119 | | - $term_diplay = htmlspecialchars( str_replace( '_', ' ', $term ) ); |
120 | | - $html = '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">' |
| 129 | + $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : str_replace( '_', ' ', $term ) ); |
| 130 | + $subtitlemsg = ( $valid ? 'searchsubtitle' : 'searchsubtitleinvalid' ); |
| 131 | + $subtitle = wfMsgWikiHtml( $subtitlemsg, $term_diplay ); |
| 132 | + $html = '<div id="searchTargetHide"><a onclick="Searching_Hide_Results();">' |
121 | 133 | . wfMsgHtml( 'hideresults' ) . '</a></div>' |
122 | 134 | . '<h1 class="firstHeading">'.wfMsgHtml('search') |
123 | | - . '</h1><div id="contentSub">'. $subtitle . '</div><ul><li>' |
124 | | - . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ), |
125 | | - wfMsgHtml( 'searchcontaining', $term_diplay ), |
126 | | - "search={$term_url}&fulltext=Search" ) |
127 | | - . '</li><li>' . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ), |
128 | | - wfMsgHtml( 'searchnamed', $term_diplay ) , |
129 | | - "search={$term_url}&go=Go" ) |
130 | | - . "</li></ul><h2>" . wfMsgHtml( 'articletitles', $term_diplay ) . "</h2>" |
131 | | - . '<ul>' .$r .'</ul>'.$more; |
| 135 | + . '</h1><div id="contentSub">'. $subtitle . '</div>'; |
| 136 | + if( $canSearch ) { |
| 137 | + $html .= '<ul><li>' |
| 138 | + . $sk->makeKnownLink( $wgContLang->specialPage( 'Search' ), |
| 139 | + wfMsgHtml( 'searchcontaining', $term_diplay ), |
| 140 | + "search={$term_url}&fulltext=Search" ) |
| 141 | + . '</li><li>' . $sk->makeKnownLink( $wgContLang->specialPage( 'Search' ), |
| 142 | + wfMsgHtml( 'searchnamed', $term_diplay ) , |
| 143 | + "search={$term_url}&go=Go" ) |
| 144 | + . "</li></ul>"; |
| 145 | + } |
| 146 | + if( $r ) { |
| 147 | + $html .= "<h2>" . wfMsgHtml( 'articletitles', $term_diplay ) . "</h2>" |
| 148 | + . '<ul>' .$r .'</ul>' . $more; |
| 149 | + } |
132 | 150 | |
133 | 151 | $response = new AjaxResponse( $html ); |
134 | 152 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1246,7 +1246,7 @@ |
1247 | 1247 | * to ensure that client-side caches don't keep obsolete copies of global |
1248 | 1248 | * styles. |
1249 | 1249 | */ |
1250 | | -$wgStyleVersion = '103'; |
| 1250 | +$wgStyleVersion = '104'; |
1251 | 1251 | |
1252 | 1252 | |
1253 | 1253 | # Server-side caching: |