Reduced the scope of the hideminor user preference to just recent
authorEvan Prodromou <evanprodromou@users.mediawiki.org>
Sat, 29 Nov 2003 18:39:04 +0000 (18:39 +0000)
committerEvan Prodromou <evanprodromou@users.mediawiki.org>
Sat, 29 Nov 2003 18:39:04 +0000 (18:39 +0000)
changes (bug #845036). User contributions and related changes now
ignore this preference.

Also, fixed a problem where the show/hide minor edits link wasn't
appearing on recent changes and related changes. Made sure that the
param gets passed through with all the links.

Made sure that user contributions also had a show/hide minor edits
thing, and that minor edits are flagged with the M (or whatever) in
user contributions.

includes/SpecialContributions.php
includes/SpecialRecentchanges.php
includes/SpecialRecentchangeslinked.php
languages/Language.php

index b538cf9..6e8f563 100644 (file)
@@ -36,37 +36,44 @@ function wfSpecialContributions( $par = "" )
                $ul .= "brrrp";
        $wgOut->setSubtitle( wfMsg( "contribsub", $ul ) );
 
-       if ( ! isset( $hideminor ) ) {
-               $hideminor = $wgUser->getOption( "hideminor" );
-       }
        if ( $hideminor ) {
                $cmq = "AND cur_minor_edit=0";
                $omq = "AND old_minor_edit=0";
-       } else { $cmq = $omq = ""; }
+               $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
+                 WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+                 "&offset={$offset}&limit={$limit}&hideminor=0" );
+       } else {
+                $cmq = $omq = "";
+               $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
+                 WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+                 "&offset={$offset}&limit={$limit}&hideminor=1" );
+        }
 
        $top = wfShowingResults( $offset, $limit );
        $wgOut->addHTML( "<p>{$top}\n" );
 
        $sl = wfViewPrevNext( $offset, $limit,
-         $wgLang->specialpage( "Contributions" ), "target=" . wfUrlEncode( $target ) );
-       $wgOut->addHTML( "<br>{$sl}\n" );
+         $wgLang->specialpage( "Contributions" ), "hideminor={$hideminor}&target=" . wfUrlEncode( $target ) );
+
+        $shm = wfMsg( "showhideminor", $mlink );
+       $wgOut->addHTML( "<br>{$sl} ($shm) \n");
        
        if ( 0 == $id ) {
-               $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment FROM cur " .
+               $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment,cur_minor_edit FROM cur " .
                  "WHERE cur_user_text='" . wfStrencode( $nt->getText() ) . "' {$cmq} " .
                  "ORDER BY inverse_timestamp LIMIT {$offlimit}";
                $res1 = wfQuery( $sql, DB_READ, $fname );
 
-               $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment FROM old " .
+               $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit FROM old " .
                  "WHERE old_user_text='" . wfStrencode( $nt->getText() ) . "' {$omq} " .
                  "ORDER BY inverse_timestamp LIMIT {$offlimit}";
                $res2 = wfQuery( $sql, DB_READ, $fname );
        } else {
-               $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment FROM cur " .
+               $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment,cur_minor_edit FROM cur " .
                  "WHERE cur_user={$id} {$cmq} ORDER BY inverse_timestamp LIMIT {$offlimit}";
                $res1 = wfQuery( $sql, DB_READ, $fname );
 
-               $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment FROM old " .
+               $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit FROM old " .
                  "WHERE old_user={$id} {$omq} ORDER BY inverse_timestamp LIMIT {$offlimit}";
                $res2 = wfQuery( $sql, DB_READ, $fname );
        }
@@ -92,6 +99,7 @@ function wfSpecialContributions( $par = "" )
                        $t = $obj1->cur_title;
                        $ts = $obj1->cur_timestamp;
                        $comment =$obj1->cur_comment;
+                        $me = $obj1->cur_minor_edit;
 
                        $obj1 = wfFetchObject( $res1 );
                        $topmark = true;                        
@@ -101,18 +109,19 @@ function wfSpecialContributions( $par = "" )
                        $t = $obj2->old_title;
                        $ts = $obj2->old_timestamp;
                        $comment =$obj2->old_comment;
+                        $me = $obj1->old_minor_edit;
 
                        $obj2 = wfFetchObject( $res2 );
                        $topmark = false;
                        --$nOld;
                }
                if( $n >= $offset )
-                       ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment );
+                       ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, ( $me > 0) );
        }
        $wgOut->addHTML( "</ul>\n" );
 }
 
-function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment )
+function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor )
 {
        global $wgLang, $wgOut, $wgUser, $target;
        $page = Title::makeName( $ns, $t );
@@ -130,7 +139,11 @@ function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment )
        }
        $d = $wgLang->timeanddate( $ts, true );
 
-       $wgOut->addHTML( "<li>{$d} {$link} {$comment}{$topmarktext}</li>\n" );
+        if ($isminor) {
+          $mflag = "<strong>" . wfMsg( "minoreditletter" ) . "</strong> ";
+        }
+
+       $wgOut->addHTML( "<li>{$d} {$mflag}{$link} {$comment}{$topmarktext}</li>\n" );
 }
 
 function ucCountLink( $lim, $d )
index c0fa2ca..74282bb 100644 (file)
@@ -51,13 +51,23 @@ function wfSpecialRecentchanges( $par )
        }
        if ( $hideminor ) {
                $hidem = "AND rc_minor=0";
-               $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchanges" ),
-                 WfMsg( "show" ), "days={$days}&limit={$limit}&hideminor=0" );
+                $mltitle = wfMsg( "show" );
+                $mlhide = 0;
+
        } else {
                $hidem = "";
-               $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchanges" ),
-                 WfMsg( "hide" ), "days={$days}&limit={$limit}&hideminor=1" );
+                $mltitle = wfMsg( "hide" );
+                $mlhide = 1;
        }
+
+        if ( isset( $from ) ) {
+          $mlparams = "from={$from}&hideminor={$mlhide}";
+        } else {
+          $mlparams = "days={$days}&limit={$limit}&hideminor=0";
+        }
+
+        $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchanges" ),
+                                     $mltitle, $mlparams );
        
        if ( !isset( $hidebots ) ) {
                $hidebots = 1;
@@ -82,11 +92,11 @@ function wfSpecialRecentchanges( $par )
        }
        $wgOut->addHTML( "\n<hr>\n{$note}\n<br>" );
 
-       $note = rcDayLimitLinks( $days, $limit );
+       $note = rcDayLimitLinks( $days, $limit, "Recentchanges",  "hideminor={$hideminor}", false, $mlink );
 
        $note .= "<br>\n" . wfMsg( "rclistfrom",
          $sk->makeKnownLink( $wgLang->specialPage( "Recentchanges" ),
-         $wgLang->timeanddate( $now, true ), "from=$now" ) );
+         $wgLang->timeanddate( $now, true ), "hideminor={$hideminor}&from=$now" ) );
 
        $wgOut->addHTML( "{$note}\n" );
 
@@ -143,7 +153,7 @@ function rcDaysLink( $lim, $d, $page="Recentchanges", $more="" )
        return $s;
 }
 
-function rcDayLimitLinks( $days, $limit, $page="Recentchanges", $more="", $doall = false )
+function rcDayLimitLinks( $days, $limit, $page="Recentchanges", $more="", $doall = false, $mlink = "" )
 {
        if ($more != "") $more .= "&";
        $cl = rcCountLink( 50, $days, $page, $more ) . " | " .
@@ -157,7 +167,8 @@ function rcDayLimitLinks( $days, $limit, $page="Recentchanges", $more="", $doall
          rcDaysLink( $limit, 14, $page, $more  ) . " | " .
          rcDaysLink( $limit, 30, $page, $more  ) .
          ( $doall ? ( " | " . rcDaysLink( $limit, 0, $page, $more ) ) : "" );
-       $note = wfMsg( "rclinks", $cl, $dl, $mlink );
+        $shm = wfMsg( "showhideminor", $mlink );
+       $note = wfMsg( "rclinks", $cl, $dl, $shm );
        return $note;
 }
 
index 458cfe6..af30777 100644 (file)
@@ -28,9 +28,6 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
        $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
 
-       if ( ! isset( $hideminor ) ) {
-               $hideminor = $wgUser->getOption( "hideminor" );
-       }
        if ( $hideminor ) {
                $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
                  WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
@@ -54,8 +51,10 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        $note = wfMsg( "rcnote", $limit, $days );
        $wgOut->addHTML( "<hr>\n{$note}\n<br>" );
 
-       $tu = "target=" . $nt->getPrefixedURL();
-       $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked", $tu );
+       $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
+                                 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
+                                 false, $mlink );
+
        $wgOut->addHTML( "{$note}\n" );
 
        $s = $sk->beginRecentChangesList();
index 16c4c89..21f8856 100644 (file)
@@ -798,7 +798,8 @@ from server time (UTC).",
 "rclistfrom"   => "Show new changes starting from $1",
 # "rclinks"            => "Show last $1 changes in last $2 hours / last $3 days",
 # "rclinks"            => "Show last $1 changes in last $2 days.",
-"rclinks"              => "Show last $1 changes in last $2 days; $3 minor edits",
+"showhideminor"         => "$1 minor edits",
+"rclinks"              => "Show last $1 changes in last $2 days; $3",
 "rchide"               => "in $4 form; $1 minor edits; $2 secondary namespaces; $3 multiple edits.",
 "rcliu"                        => "; $1 edits from logged in users",
 "diff"                 => "diff",