* (bug 13824) AJAX search suggestion now works with non-SkinTemplate skins
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 22 Apr 2008 22:35:50 +0000 (22:35 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 22 Apr 2008 22:35:50 +0000 (22:35 +0000)
The setup code was using a MonoBook-specific div ID to insert the results container into. Swapped that for the plain ol' document.body and fixed the styles for MonoBook and Modern so it gets the scale-up fix for the font size (they both use a weird system where they shrink the font size on the body, then scale it back up inside.... very wtf territory!)

Added setup for form and input IDs used for the second search box on Cologne Blue, and copied those IDs over to Nostalgia and Classic skins.

Note that the drop-down is a bit unsatisfactory on the page-bottom search boxes in Nostalgia, Classic, and Cologne Blue, as it tries to squish in at the bottom of the page, and you only get two lines of data. The sidebar search boxes are also not very wide, which makes results pretty cramped.

RELEASE-NOTES
includes/DefaultSettings.php
includes/Skin.php
skins/CologneBlue.php
skins/common/mwsuggest.js
skins/modern/main.css
skins/monobook/main.css

index 25a0243..2cc5255 100644 (file)
@@ -210,6 +210,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 13796) Show links to parent pages even if some of them are missing
 * (bug 13816) Filter by main namespace doesn't work on WhatLinksHere
 * (bug 13822) Fatal error on some pages when calculating subpage subtitle
+* (bug 13824) AJAX search suggestion now works with non-SkinTemplate skins
+
 
 === API changes in 1.13 ===
 
index 4ec5eb1..57b5bf9 100644 (file)
@@ -1334,7 +1334,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches don't keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '138';
+$wgStyleVersion = '139';
 
 
 # Server-side caching:
index 5abb40b..b60709c 100644 (file)
@@ -17,6 +17,8 @@ class Skin extends Linker {
         * @private
         */
        var $mWatchLinkNum = 0; // Appended to end of watch link id's
+       // How many search boxes have we made?  Avoid duplicate id's.
+       protected $searchboxes = '';
        /**#@-*/
        protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
        protected $skinname = 'standard' ;
@@ -986,13 +988,16 @@ END;
                global $wgRequest;
                $search = $wgRequest->getText( 'search' );
 
-               $s = '<form name="search" class="inline" method="post" action="'
+               $s = '<form id="searchform'.$this->searchboxes.'" name="search" class="inline" method="post" action="'
                  . $this->escapeSearchLink() . "\">\n"
-                 . '<input type="text" name="search" size="19" value="'
+                 . '<input type="text" id="searchInput'.$this->searchboxes.'" name="search" size="19" value="'
                  . htmlspecialchars(substr($search,0,256)) . "\" />\n"
                  . '<input type="submit" name="go" value="' . wfMsg ('searcharticle') . '" />&nbsp;'
                  . '<input type="submit" name="fulltext" value="' . wfMsg ('searchbutton') . "\" />\n</form>";
 
+               // Ensure unique id's for search boxes made after the first
+               $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
+               
                return $s;
        }
 
index 6889b39..72598f2 100644 (file)
@@ -15,9 +15,6 @@ if( !defined( 'MEDIAWIKI' ) )
  */
 class SkinCologneBlue extends Skin {
 
-       private $searchboxes = '';
-       // How many search boxes have we made?  Avoid duplicate id's.
-
        function getStylesheet() {
                return 'common/cologneblue.css';
        }
index 53dbcf9..a65f82b 100644 (file)
@@ -25,8 +25,8 @@ var os_mouse_moved = false;
 // delay between keypress and suggestion (in ms)
 var os_search_timeout = 250;
 // these pairs of inputs/forms will be autoloaded at startup
-var os_autoload_inputs = new Array('searchInput', 'powerSearchText', 'searchText');
-var os_autoload_forms = new Array('searchform', 'powersearch', 'search' );
+var os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText');
+var os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' );
 // if we stopped the service
 var os_is_stopped = false;
 // max lines to show in suggest table
@@ -178,10 +178,9 @@ function os_createContainer(r){
        var pos = os_getElementPosition(r.searchbox);   
        var left = pos.left;
        var top = pos.top + s.offsetHeight;
-       var body = document.getElementById("globalWrapper");
        c.className = "os-suggest";
        c.setAttribute("id", r.container);      
-       body.appendChild(c); 
+       document.body.appendChild(c); 
        
        // dynamically generated style params   
        // IE workaround, cannot explicitely set "style" attribute
index bfa77b0..a00a5d4 100644 (file)
@@ -12,7 +12,8 @@ body {
 
 #mw_main,
 #p-personal,
-#mw_header {
+#mw_header,
+.os-suggest {
        font-size: 130%;
 }
 
index 9a45c6f..001e050 100644 (file)
@@ -1566,3 +1566,7 @@ span.searchmatch {
        font-weight: bold;
 }
 
+/* God-damned hack for the crappy layout */
+.os-suggest {
+       font-size: 127%;
+}