* Add form to RCLinked and add to sp:specialpages
[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, $wgContLang;
18 $prefix = $this->prefix;
19 $t = SpecialPage::getTitleFor( $this->getName() );
20 $align = $wgContLang->isRtl() ? 'left' : 'right';
21
22 $s = '<p>' . wfMsgExt( 'withoutinterwiki-header', array( 'parseinline' ) ) . '</p>';
23 $s .= Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
24 $s .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
25 $s .= Xml::hidden( 'title', $t->getPrefixedText() );
26 $s .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'withoutinterwiki' ) );
27 $s .= "<tr>
28 <td align='$align'>" .
29 Xml::label( wfMsg( 'allpagesprefix' ), 'wiprefix' ) .
30 "</td>
31 <td>" .
32 Xml::input( 'prefix', 20, htmlspecialchars ( $prefix ), array( 'id' => 'wiprefix' ) ) .
33 "</td>
34 </tr>
35 <tr>
36 <td align='$align'></td>
37 <td>" .
38 Xml::submitButton( wfMsgHtml( 'withoutinterwiki-submit' ) ) .
39 "</td>
40 </tr>";
41 $s .= Xml::closeElement( 'table' );
42 $s .= Xml::closeElement( 'form' );
43 $s .= Xml::closeElement( 'div' );
44 return $s;
45 }
46
47 function sortDescending() {
48 return false;
49 }
50
51 function isExpensive() {
52 return true;
53 }
54
55 function isSyndicated() {
56 return false;
57 }
58
59 function getSQL() {
60 $dbr = wfGetDB( DB_SLAVE );
61 list( $page, $langlinks ) = $dbr->tableNamesN( 'page', 'langlinks' );
62 $prefix = $this->prefix ? "AND page_title LIKE '" . $dbr->escapeLike( $this->prefix ) . "%'" : '';
63 return
64 "SELECT 'Withoutinterwiki' AS type,
65 page_namespace AS namespace,
66 page_title AS title,
67 page_title AS value
68 FROM $page
69 LEFT JOIN $langlinks
70 ON ll_from = page_id
71 WHERE ll_title IS NULL
72 AND page_namespace=" . NS_MAIN . "
73 AND page_is_redirect = 0
74 {$prefix}";
75 }
76
77 function setPrefix( $prefix = '' ) {
78 $this->prefix = $prefix;
79 }
80
81 }
82
83 function wfSpecialWithoutinterwiki() {
84 global $wgRequest;
85 list( $limit, $offset ) = wfCheckLimits();
86 $prefix = $wgRequest->getVal( 'prefix' );
87 $wip = new WithoutInterwikiPage();
88 $wip->setPrefix( $prefix );
89 $wip->doQuery( $offset, $limit );
90 }
91
92