summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialNewpages.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-06-10 13:00:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2009-06-10 13:00:47 +0200
commit72e90545454c0e014318fa3c81658e035aac58c1 (patch)
tree9212e3f46868989c4d57ae9a5c8a1a80e4dc0702 /includes/specials/SpecialNewpages.php
parent565a0ccc371ec1a2a0e9b39487cbac18e6f60e25 (diff)
applying patch to version 1.15.0
Diffstat (limited to 'includes/specials/SpecialNewpages.php')
-rw-r--r--includes/specials/SpecialNewpages.php64
1 files changed, 52 insertions, 12 deletions
diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php
index 08e776d8..886c41a2 100644
--- a/includes/specials/SpecialNewpages.php
+++ b/includes/specials/SpecialNewpages.php
@@ -24,7 +24,7 @@ class SpecialNewpages extends SpecialPage {
$opts = new FormOptions();
$this->opts = $opts; // bind
$opts->add( 'hideliu', false );
- $opts->add( 'hidepatrolled', false );
+ $opts->add( 'hidepatrolled', $wgUser->getBoolOption( 'newpageshidepatrolled' ) );
$opts->add( 'hidebots', false );
$opts->add( 'hideredirs', true );
$opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) );
@@ -32,6 +32,7 @@ class SpecialNewpages extends SpecialPage {
$opts->add( 'namespace', '0' );
$opts->add( 'username', '' );
$opts->add( 'feed', '' );
+ $opts->add( 'tagfilter', '' );
// Set values
$opts->fetchValuesFromRequest( $wgRequest );
@@ -121,7 +122,7 @@ class SpecialNewpages extends SpecialPage {
}
protected function filterLinks() {
- global $wgGroupPermissions, $wgUser;
+ global $wgGroupPermissions, $wgUser, $wgLang;
// show/hide links
$showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
@@ -154,7 +155,7 @@ class SpecialNewpages extends SpecialPage {
$links[$key] = wfMsgHtml( $msg, $link );
}
- return implode( ' | ', $links );
+ return $wgLang->pipeList( $links );
}
protected function form() {
@@ -176,6 +177,10 @@ class SpecialNewpages extends SpecialPage {
}
$hidden = implode( "\n", $hidden );
+ $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
+ if ($tagFilter)
+ list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter;
+
$form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
Xml::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
Xml::fieldset( wfMsg( 'newpages' ) ) .
@@ -187,7 +192,15 @@ class SpecialNewpages extends SpecialPage {
<td class='mw-input'>" .
Xml::namespaceSelector( $namespace, 'all' ) .
"</td>
- </tr>" .
+ </tr>" . ( $tagFilter ? (
+ "<tr>
+ <td class='mw-label'>" .
+ $tagFilterLabel .
+ "</td>
+ <td class='mw-input'>" .
+ $tagFilterSelector .
+ "</td>
+ </tr>" ) : '' ) .
($wgEnableNewpagesUserFilter ?
"<tr>
<td class='mw-label'>" .
@@ -235,20 +248,32 @@ class SpecialNewpages extends SpecialPage {
*/
public function formatRow( $result ) {
global $wgLang, $wgContLang, $wgUser;
+
+ $classes = array();
+
$dm = $wgContLang->getDirMark();
$title = Title::makeTitleSafe( $result->rc_namespace, $result->rc_title );
$time = $wgLang->timeAndDate( $result->rc_timestamp, true );
- $plink = $this->skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rc_id : '' );
+ $query = $this->patrollable( $result ) ? "rcid={$result->rc_id}&redirect=no" : 'redirect=no';
+ $plink = $this->skin->makeKnownLinkObj( $title, '', $query );
$hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$length = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
$wgLang->formatNum( $result->length ) );
$ulink = $this->skin->userLink( $result->rc_user, $result->rc_user_text ) . ' ' .
$this->skin->userToolLinks( $result->rc_user, $result->rc_user_text );
$comment = $this->skin->commentBlock( $result->rc_comment );
- $css = $this->patrollable( $result ) ? " class='not-patrolled'" : '';
+
+ if ( $this->patrollable( $result ) )
+ $classes[] = 'not-patrolled';
+
+ # Tags, if any.
+ list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages' );
+ $classes = array_merge( $classes, $newClasses );
+
+ $css = count($classes) ? ' class="'.implode( " ", $classes).'"' : '';
- return "<li{$css}>{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment}</li>\n";
+ return "<li{$css}>{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment} {$tagDisplay}</li>\n";
}
/**
@@ -331,7 +356,7 @@ class SpecialNewpages extends SpecialPage {
protected function feedItemDesc( $row ) {
$revision = Revision::newFromId( $row->rev_id );
if( $revision ) {
- return '<p>' . htmlspecialchars( $revision->getUserText() ) . ': ' .
+ return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
"</p>\n<hr />\n<div>" .
nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
@@ -377,7 +402,6 @@ class NewPagesPager extends ReverseChronologicalPager {
} else {
$rcIndexes = array( 'rc_timestamp' );
}
- $conds[] = 'page_id = rc_cur_id';
# $wgEnableNewpagesUserFilter - temp WMF hack
if( $wgEnableNewpagesUserFilter && $user ) {
@@ -399,13 +423,29 @@ class NewPagesPager extends ReverseChronologicalPager {
$conds['page_is_redirect'] = 0;
}
- return array(
+ $info = array(
'tables' => array( 'recentchanges', 'page' ),
'fields' => 'rc_namespace,rc_title, rc_cur_id, rc_user,rc_user_text,rc_comment,
- rc_timestamp,rc_patrolled,rc_id,page_len as length, page_latest as rev_id',
+ rc_timestamp,rc_patrolled,rc_id,page_len as length, page_latest as rev_id, ts_tags',
'conds' => $conds,
- 'options' => array( 'USE INDEX' => array('recentchanges' => $rcIndexes) )
+ 'options' => array( 'USE INDEX' => array('recentchanges' => $rcIndexes) ),
+ 'join_conds' => array(
+ 'page' => array('INNER JOIN', 'page_id=rc_cur_id'),
+ ),
);
+
+ ## Empty array for fields, it'll be set by us anyway.
+ $fields = array();
+
+ ## Modify query for tags
+ ChangeTags::modifyDisplayQuery( $info['tables'],
+ $fields,
+ $info['conds'],
+ $info['join_conds'],
+ $info['options'],
+ $this->opts['tagfilter'] );
+
+ return $info;
}
function getIndexField() {