r76036 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76035‎ | r76036 | r76037 >
Date:21:12, 4 November 2010
Author:yaron
Status:deferred
Tags:
Comment:
Changed/added display info for both 'all approved pages' and 'approval is not latest' lists
Modified paths:
  • /trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php
@@ -144,18 +144,43 @@
145145 $pageLink = $skin->makeLinkObj( $title );
146146 if ( $this->mMode == 'unapproved' ) {
147147 return $pageLink;
 148+ } elseif ( $this->mMode == 'notlatest' ) {
 149+ $diffLink = Xml::element( 'a',
 150+ array( 'href' => $title->getLocalUrl(
 151+ array(
 152+ 'diff' => $result->latest_id,
 153+ 'oldid' => $result->rev_id
 154+ )
 155+ ) ),
 156+ wfMsg( 'approvedrevs-difffromlatest' )
 157+ );
 158+ return "$pageLink ($diffLink)";
148159 } else {
 160+ global $wgUser, $wgOut, $wgLang;
149161 if ( $result->rev_id == $result->latest_id ) {
150162 $class = "approvedRevIsLatest";
151163 } else {
152164 $class = "approvedRevNotLatest";
153165 }
154 - return $pageLink . ' (' .
155 - Xml::element( 'span',
156 - array ( 'class' => $class ),
157 - wfMsg( 'approvedrevs-revisionnumber', $result->rev_id )
158 - ) .
159 - ')';
 166+ $additionalInfo = Xml::element( 'span',
 167+ array ( 'class' => $class ),
 168+ wfMsg( 'approvedrevs-revisionnumber', $result->rev_id )
 169+ );
 170+
 171+ // Get data on the most recent approval from the
 172+ // 'approval' log, and display it if it's there.
 173+ $sk = $wgUser->getSkin();
 174+ $loglist = new LogEventsList( $sk, $wgOut );
 175+ $pager = new LogPager( $loglist, array( 'approval' ), '', $title->getText() );
 176+ $pager->mLimit = 1;
 177+ $pager->doQuery();
 178+ $row = $pager->mResult->fetchObject();
 179+ if ( !empty( $row ) ) {
 180+ $time = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->log_timestamp ), true );
 181+ $userLink = $sk->userLink( $row->log_user, $row->user_name );
 182+ $additionalInfo .= ', ' . wfMsg( 'approvedrevs-approvedby', $userLink, $time );
 183+ }
 184+ return "$pageLink ($additionalInfo)";
160185 }
161186 }
162187 }

Status & tagging log