From: Brion Vibber Date: Fri, 9 Apr 2004 06:27:18 +0000 (+0000) Subject: If somebody accidentally wanders into Special:Booksources, ask for an ISBN X-Git-Tag: 1.3.0beta1~540 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=56abcd25c43ea321a190010d87cb02a83cc0fa7e;p=lhc%2Fweb%2Fwiklou.git If somebody accidentally wanders into Special:Booksources, ask for an ISBN number. The raw list isn't that useful, and will lead to broken search pages. --- diff --git a/includes/SpecialBooksources.php b/includes/SpecialBooksources.php index f527276cb1..8e7aa72c81 100644 --- a/includes/SpecialBooksources.php +++ b/includes/SpecialBooksources.php @@ -18,63 +18,80 @@ function wfSpecialBooksources( $par ) } class BookSourceList { - var $mIsbn; - function BookSourceList( $isbn ) - { + function BookSourceList( $isbn ) { $this->mIsbn = $isbn; } - function show() - { - global $wgOut, $wgUser, $wgLang; - $fname = "BookSourceList::show()"; - $noautolist = false; + function show() { + global $wgOut; $wgOut->setPagetitle( wfMsg( "booksources" ) ); - $bstext = wfMsg( "booksourcetext" ); - - if( $this->mIsbn ) { - $bstitle = Title::newFromText( wfmsg( "booksources" ) ); - $sql = "SELECT cur_text FROM cur " . - "WHERE cur_namespace=4 and cur_title='" . - wfStrencode( $bstitle->getDBkey() ) . "'"; - $res = wfQuery( $sql, DB_READ, $fname ); - if( ( $s = wfFetchObject( $res ) ) and ( $s->cur_text != "" ) ) { - $bstext = $s->cur_text; - $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext ); - $noautolist = true; - } + if( empty( $this->mIsbn ) ) { + $this->askForm(); + } else { + $this->showList(); } - - $wgOut->addWikiText( $bstext ); + } + + function showList() { + global $wgOut, $wgUser, $wgLang; + $fname = "BookSourceList::showList()"; - # If ISBN is blank, just show a list of links to the - # home page of the various book sites. Otherwise, show - # a list of links directly to the book. - - if( !$noautolist ) { # only do this if we haven't already shown [[Wikipedia:Book sources]] - $s = "\n"; + + $wgOut->addHTML( $s ); + } + + function askForm() { + global $wgOut, $wgLang, $wgTitle; + $fname = "BookSourceList::askForm()"; + + $action = $wgTitle->escapeLocalUrl(); + $isbn = htmlspecialchars( wfMsg( "isbn" ) ); + $go = htmlspecialchars( wfMsg( "go" ) ); + $out = "
+ $isbn: + +
"; + $wgOut->addHTML( $out ); } } diff --git a/languages/Language.php b/languages/Language.php index 8822ed0ecf..a1f583c3aa 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1166,6 +1166,7 @@ sell new and used books, and may also have further information about books you are looking for. {{SITENAME}} is not affiliated with any of these businesses, and this list should not be construed as an endorsement.", +"isbn" => "ISBN", "rfcurl" => "http://www.faqs.org/rfcs/rfc$1.html", "alphaindexline" => "$1 to $2", "version" => "Version",