Index: trunk/extensions/ProofreadPage/ProofreadPage.i18n.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | |
12 | 12 | $messages['en'] = array( |
13 | 13 | 'indexpages' => 'List of index pages', |
| 14 | + 'nakedpages' => 'Naked pages', |
14 | 15 | 'proofreadpage_desc' => 'Allow easy comparison of text to the original scan', |
15 | 16 | 'proofreadpage_namespace' => 'Page', |
16 | 17 | 'proofreadpage_index_namespace' => 'Index', |
Index: trunk/extensions/ProofreadPage/SpecialNakedPages.php |
— | — | @@ -0,0 +1,110 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * This program is free software; you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation; either version 2 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License along |
| 16 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | + * http://www.gnu.org/copyleft/gpl.html |
| 19 | + */ |
| 20 | + |
| 21 | + /* |
| 22 | + * Special page that lists the texts that have no transclusions |
| 23 | + * Pages in MediaWiki:Proofreadpage_notnaked_category are excluded. |
| 24 | + * |
| 25 | + */ |
| 26 | + |
| 27 | +class NakedPages extends SpecialPage { |
| 28 | + |
| 29 | + function __construct() { |
| 30 | + parent::__construct( 'NakedPages' ); |
| 31 | + } |
| 32 | + |
| 33 | + function execute( $parameters ) { |
| 34 | + global $wgOut, $wgRequest, $wgDisableTextSearch; |
| 35 | + $this->setHeaders(); |
| 36 | + list( $limit, $offset ) = wfCheckLimits(); |
| 37 | + $cnl = new NakedPagesQuery( ); |
| 38 | + $cnl->doQuery( $offset, $limit ); |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +class NakedPagesQuery extends QueryPage { |
| 44 | + |
| 45 | + function __construct( ) { |
| 46 | + wfLoadExtensionMessages( 'ProofreadPage' ); |
| 47 | + $this->page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
| 48 | + $this->cat = wfMsgForContent( 'proofreadpage_notnaked_category' ); |
| 49 | + } |
| 50 | + |
| 51 | + function getName() { |
| 52 | + return 'NakedPages'; |
| 53 | + } |
| 54 | + |
| 55 | + function isExpensive() { |
| 56 | + return true; |
| 57 | + } |
| 58 | + |
| 59 | + function isSyndicated() { |
| 60 | + return false; |
| 61 | + } |
| 62 | + |
| 63 | + function getSQL() { |
| 64 | + global $wgContentNamespaces; |
| 65 | + |
| 66 | + $dbr = wfGetDB( DB_SLAVE ); |
| 67 | + $page = $dbr->tableName( 'page' ); |
| 68 | + $templatelinks = $dbr->tableName( 'templatelinks' ); |
| 69 | + $categorylinks = $dbr->tableName( 'categorylinks' ); |
| 70 | + $forceindex = $dbr->useIndexClause("page_len"); |
| 71 | + $page_ns_index = MWNamespace::getCanonicalIndex( strtolower( $this->page_namespace ) ); |
| 72 | + $cat = $dbr->strencode( str_replace( ' ' , '_' , $this->cat ) ); |
| 73 | + $clause = "page_namespace=" . NS_MAIN . " AND page_is_redirect=0 AND page_id NOT IN ( SELECT DISTINCT tl_from FROM $templatelinks LEFT JOIN $page ON page_id=tl_from WHERE tl_namespace=$page_ns_index AND page_namespace=" . NS_MAIN . " ) AND page_id NOT IN ( SELECT DISTINCT cl_from FROM $categorylinks WHERE cl_to='$cat' )"; |
| 74 | + |
| 75 | + return |
| 76 | + "SELECT page_namespace as namespace, |
| 77 | + page_title as title, |
| 78 | + page_len AS value |
| 79 | + FROM $page $forceindex |
| 80 | + WHERE $clause"; |
| 81 | + } |
| 82 | + |
| 83 | + function sortDescending() { |
| 84 | + return true; |
| 85 | + } |
| 86 | + |
| 87 | + function formatResult( $skin, $result ) { |
| 88 | + global $wgLang, $wgContLang; |
| 89 | + $dm = $wgContLang->getDirMark(); |
| 90 | + |
| 91 | + $title = Title::makeTitleSafe( $result->namespace, $result->title ); |
| 92 | + if ( !$title ) { |
| 93 | + return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->'; |
| 94 | + } |
| 95 | + $hlink = $skin->linkKnown( |
| 96 | + $title, |
| 97 | + wfMsgHtml( 'hist' ), |
| 98 | + array(), |
| 99 | + array( 'action' => 'history' ) |
| 100 | + ); |
| 101 | + $plink = $this->isCached() |
| 102 | + ? $skin->link( $title ) |
| 103 | + : $skin->linkKnown( $title ); |
| 104 | + $size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), $wgLang->formatNum( htmlspecialchars( $result->value ) ) ); |
| 105 | + |
| 106 | + return $title->exists() |
| 107 | + ? "({$hlink}) {$dm}{$plink} {$dm}[{$size}]" |
| 108 | + : "<s>({$hlink}) {$dm}{$plink} {$dm}[{$size}]</s>"; |
| 109 | + } |
| 110 | +} |
| 111 | + |
Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -43,6 +43,11 @@ |
44 | 44 | $wgSpecialPages['IndexPages'] = 'ProofreadPages'; |
45 | 45 | $wgSpecialPageGroups['IndexPages'] = 'pages'; |
46 | 46 | |
| 47 | +# special page |
| 48 | +$wgAutoloadClasses['NakedPages'] = dirname( __FILE__ ) . '/SpecialNakedPages.php'; |
| 49 | +$wgSpecialPages['NakedPages'] = 'NakedPages'; |
| 50 | +$wgSpecialPageGroups['NakedPages'] = 'maintenance'; |
| 51 | + |
47 | 52 | # Bump the version number every time you change proofread.js |
48 | 53 | $wgProofreadPageVersion = 27; |
49 | 54 | |