*Add option to show changes to pages linked *to* said page
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 13 Apr 2008 15:27:26 +0000 (15:27 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 13 Apr 2008 15:27:26 +0000 (15:27 +0000)
*Make UI actually explain what Related Changes actually does

includes/SpecialRecentchangeslinked.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 96bfa5a..c922ced 100644 (file)
@@ -20,6 +20,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
        $days = $wgRequest->getInt( 'days' );
        $target = isset($par) ? $par : $wgRequest->getVal( 'target' );
        $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
+       $showlinkedto = $wgRequest->getBool( 'showlinkedto' ) ? 1 : 0;
 
        $wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
        $sk = $wgUser->getSkin();
@@ -29,6 +30,8 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
                Xml::openElement( 'fieldset' ) .
                Xml::element( 'legend', array(), wfMsg( 'recentchangeslinked' ) ) . "\n" .
                Xml::inputLabel( wfMsg( 'recentchangeslinked-page' ), 'target', 'recentchangeslinked-target', 40, $target ) .
+               '<p>' . Xml::check( 'showlinkedto', $showlinkedto, array('id' => 'showlinkedto') ) .
+               ' ' . Xml::label( wfMsg("recentchangeslinked-to"), 'showlinkedto' ) . "</p>\n" .
                Xml::hidden( 'title', $wgTitle->getPrefixedText() ). "\n" .
                Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
                Xml::closeElement( 'fieldset' ) .
@@ -119,6 +122,14 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
 $GROUPBY
  ";
        } else {
+               if( $showlinkedto ) {
+                       $ns = $dbr->addQuotes( $nt->getNamespace() );
+                       $dbkey = $dbr->addQuotes( $nt->getDBkey() );
+                       $joinConds = "AND pl_namespace={$ns} AND pl_title={$dbkey} AND pl_from=rc_cur_id";
+               } else {
+                       $joinConds = "AND pl_namespace=rc_namespace AND pl_title=rc_title AND pl_from=$id";
+               }
+       
                $sql =
 "SELECT /* wfSpecialRecentchangeslinked */
                        rc_id,
@@ -147,9 +158,7 @@ $GROUPBY
 " . ($uid ? " LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "
    WHERE rc_timestamp > '{$cutoff}'
        {$cmq}
-     AND pl_namespace=rc_namespace
-     AND pl_title=rc_title
-     AND pl_from=$id
+    {$joinConds}
 $GROUPBY
 ";
        }
index 864681b..25ff9f2 100644 (file)
@@ -1480,9 +1480,11 @@ An unchecked box means the user is not in that group.',
 'recentchangeslinked'          => 'Related changes',
 'recentchangeslinked-title'    => 'Changes related to "$1"',
 'recentchangeslinked-noresult' => 'No changes on linked pages during the given period.',
-'recentchangeslinked-summary'  => "This special page lists the last changes on pages who are linked.
+'recentchangeslinked-summary'  => "This special page lists the last changes to pages linked ''from'' the given page.
+However, if the page given is a category, it lists the recent changes to member pages instead.
 Pages on your watchlist are '''bold'''.",
 'recentchangeslinked-page'     => 'Page name',
+'recentchangeslinked-to'       => "Show changes to pages linked to the given page instead",
 
 # Upload
 'upload'                      => 'Upload file',
index d6496c2..dbea89b 100644 (file)
@@ -870,6 +870,7 @@ $wgMessageStructure = array(
                'recentchangeslinked-noresult',
                'recentchangeslinked-summary',
                'recentchangeslinked-page',
+               'recentchangeslinked-to',
        ),
        'upload' => array(
                'upload',