X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FChangesList.php;h=f3dcf67b5f9115b1f51da28fabf06fe6964a9f48;hb=e6fb2a2c556379197dd63943f91f8fc9997c9632;hp=02c02e0d283a670239ba99d33ba110aa3ee88f7e;hpb=f88e17f2717d1d3060408f816ca79c2275a3d4a1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 02c02e0d28..f3dcf67b5f 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -136,9 +136,10 @@ class ChangesList extends ContextSource { * @param string $nothing to use for empty space * @return String */ - protected function recentChangesFlags( $flags, $nothing = ' ' ) { + public function recentChangesFlags( $flags, $nothing = ' ' ) { + global $wgRecentChangesFlags; $f = ''; - foreach ( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) { + foreach ( array_keys( $wgRecentChangesFlags ) as $flag ) { $f .= isset( $flags[$flag] ) && $flags[$flag] ? self::flag( $flag ) : $nothing; @@ -152,36 +153,35 @@ class ChangesList extends ContextSource { * unpatrolled edit. By default in English it will contain "N", "m", "b", * "!" respectively, plus it will have an appropriate title and class. * - * @param string $flag 'newpage', 'unpatrolled', 'minor', or 'bot' + * @param string $flag One key of $wgRecentChangesFlags * @return String: Raw HTML */ public static function flag( $flag ) { - static $messages = null; - if ( is_null( $messages ) ) { - $messages = array( - 'newpage' => array( 'newpageletter', 'recentchanges-label-newpage' ), - 'minoredit' => array( 'minoreditletter', 'recentchanges-label-minor' ), - 'botedit' => array( 'boteditletter', 'recentchanges-label-bot' ), - 'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ), - ); - foreach ( $messages as &$value ) { - $value[0] = wfMessage( $value[0] )->escaped(); - $value[1] = wfMessage( $value[1] )->escaped(); + static $flagInfos = null; + if ( is_null( $flagInfos ) ) { + global $wgRecentChangesFlags; + $flagInfos = array(); + foreach ( $wgRecentChangesFlags as $key => $value ) { + $flagInfos[$key]['letter'] = wfMessage( $value['letter'] )->escaped(); + $flagInfos[$key]['title'] = wfMessage( $value['title'] )->escaped(); + // Allow customized class name, fall back to flag name + $flagInfos[$key]['class'] = Sanitizer::escapeClass( + isset( $value['class'] ) ? $value['class'] : $key ); } } - # Inconsistent naming, bleh + // Inconsistent naming, bleh, kepted for b/c $map = array( - 'newpage' => 'newpage', - 'minor' => 'minoredit', - 'bot' => 'botedit', - 'unpatrolled' => 'unpatrolled', - 'minoredit' => 'minoredit', - 'botedit' => 'botedit', + 'minoredit' => 'minor', + 'botedit' => 'bot', ); - $flag = $map[$flag]; + if ( isset( $map[$flag] ) ) { + $flag = $map[$flag]; + } - return "" . $messages[$flag][0] . ''; + return "" . + $flagInfos[$flag]['letter'] . + ''; } /** @@ -194,7 +194,7 @@ class ChangesList extends ContextSource { $this->rcCacheIndex = 0; $this->lastdate = ''; $this->rclistOpen = false; - $this->getOutput()->addModules( 'mediawiki.special.changeslist' ); + $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' ); return ''; } @@ -362,8 +362,6 @@ class ChangesList extends ContextSource { * @param $watched */ public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) { - global $wgUseRCPatrol; - $params = array(); $articlelink = Linker::linkKnown( @@ -456,10 +454,15 @@ class ChangesList extends ContextSource { /** * Check whether to enable recent changes patrol features + * + * @deprecated since 1.22 * @return Boolean */ public static function usePatrol() { global $wgUser; + + wfDeprecated( __METHOD__, '1.22' ); + return $wgUser->useRCPatrol(); } @@ -703,7 +706,14 @@ class EnhancedChangesList extends ChangesList { $this->rcCacheIndex = 0; $this->lastdate = ''; $this->rclistOpen = false; - $this->getOutput()->addModules( 'mediawiki.special.changeslist' ); + $this->getOutput()->addModuleStyles( array( + 'mediawiki.special.changeslist', + 'mediawiki.special.changeslist.enhanced', + ) ); + $this->getOutput()->addModules( array( + 'jquery.makeCollapsible', + 'mediawiki.icon', + ) ); return ''; } /** @@ -1198,7 +1208,7 @@ class EnhancedChangesList extends ChangesList { $r .= ''; # Flag and Timestamp if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) { - $r .= '    '; // 4 flags -> 4 spaces + $r .= $this->recentChangesFlags( array() ); // no flags, but need the placeholders } else { $r .= $this->recentChangesFlags( array( 'newpage' => $type == RC_NEW,