* Add a nice fieldset around the input form
[lhc/web/wiklou.git] / includes / SpecialWithoutinterwiki.php
1 <?php
2
3 /**
4 * Special page lists pages without language links
5 *
6 * @addtogroup SpecialPage
7 * @author Rob Church <robchur@gmail.com>
8 */
9 class WithoutInterwikiPage extends PageQueryPage {
10 private $prefix = '';
11
12 function getName() {
13 return 'Withoutinterwiki';
14 }
15
16 function getPageHeader() {
17 global $wgScript;
18 $prefix = $this->prefix;
19 $t = SpecialPage::getTitleFor( $this->getName() );
20
21 return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
22 Xml::openElement( 'fieldset' ) .
23 Xml::element( 'legend', null, wfMsg( 'withoutinterwiki-legend' ) ) .
24 Xml::hidden( 'title', $t->getPrefixedText() ) .
25 Xml::inputLabel( wfMsg( 'allpagesprefix' ), 'prefix', 'wiprefix', 20, $prefix ) . ' ' .
26 Xml::submitButton( wfMsg( 'withoutinterwiki-submit' ) ) .
27 Xml::closeElement( 'fieldset' ) .
28 Xml::closeElement( 'form' );
29 }
30
31 function sortDescending() {
32 return false;
33 }
34
35 function isExpensive() {
36 return true;
37 }
38
39 function isSyndicated() {
40 return false;
41 }
42
43 function getSQL() {
44 $dbr = wfGetDB( DB_SLAVE );
45 list( $page, $langlinks ) = $dbr->tableNamesN( 'page', 'langlinks' );
46 $prefix = $this->prefix ? "AND page_title LIKE '" . $dbr->escapeLike( $this->prefix ) . "%'" : '';
47 return
48 "SELECT 'Withoutinterwiki' AS type,
49 page_namespace AS namespace,
50 page_title AS title,
51 page_title AS value
52 FROM $page
53 LEFT JOIN $langlinks
54 ON ll_from = page_id
55 WHERE ll_title IS NULL
56 AND page_namespace=" . NS_MAIN . "
57 AND page_is_redirect = 0
58 {$prefix}";
59 }
60
61 function setPrefix( $prefix = '' ) {
62 $this->prefix = $prefix;
63 }
64
65 }
66
67 function wfSpecialWithoutinterwiki() {
68 global $wgRequest, $wgContLang, $wgCapitalLinks;
69 list( $limit, $offset ) = wfCheckLimits();
70 if( $wgCapitalLinks ) {
71 $prefix = $wgContLang->ucfirst( $wgRequest->getVal( 'prefix' ) );
72 } else {
73 $prefix = $wgRequest->getVal( 'prefix' );
74 }
75 $wip = new WithoutInterwikiPage();
76 $wip->setPrefix( $prefix );
77 $wip->doQuery( $offset, $limit );
78 }