From a3d16adadd8f9e9d00938498f7f51c1c85c2a653 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 29 Nov 2003 18:39:04 +0000 Subject: [PATCH] Reduced the scope of the hideminor user preference to just recent 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 | 39 ++++++++++++++++--------- includes/SpecialRecentchanges.php | 27 ++++++++++++----- includes/SpecialRecentchangeslinked.php | 9 +++--- languages/Language.php | 3 +- 4 files changed, 51 insertions(+), 27 deletions(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index b538cf9713..6e8f56353e 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -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( "

{$top}\n" ); $sl = wfViewPrevNext( $offset, $limit, - $wgLang->specialpage( "Contributions" ), "target=" . wfUrlEncode( $target ) ); - $wgOut->addHTML( "
{$sl}\n" ); + $wgLang->specialpage( "Contributions" ), "hideminor={$hideminor}&target=" . wfUrlEncode( $target ) ); + + $shm = wfMsg( "showhideminor", $mlink ); + $wgOut->addHTML( "
{$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( "\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( "

  • {$d} {$link} {$comment}{$topmarktext}
  • \n" ); + if ($isminor) { + $mflag = "" . wfMsg( "minoreditletter" ) . " "; + } + + $wgOut->addHTML( "
  • {$d} {$mflag}{$link} {$comment}{$topmarktext}
  • \n" ); } function ucCountLink( $lim, $d ) diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index c0fa2ca88d..74282bb2b7 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -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
    \n{$note}\n
    " ); - $note = rcDayLimitLinks( $days, $limit ); + $note = rcDayLimitLinks( $days, $limit, "Recentchanges", "hideminor={$hideminor}", false, $mlink ); $note .= "
    \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; } diff --git a/includes/SpecialRecentchangeslinked.php b/includes/SpecialRecentchangeslinked.php index 458cfe6d9b..af30777ff4 100644 --- a/includes/SpecialRecentchangeslinked.php +++ b/includes/SpecialRecentchangeslinked.php @@ -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( "
    \n{$note}\n
    " ); - $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(); diff --git a/languages/Language.php b/languages/Language.php index 16c4c89c30..21f8856fc8 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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", -- 2.20.1