- /**
- * Return the legend displayed within the fieldset.
- *
- * This method is also called from SpecialWatchlist.
- *
- * @param $context the object available as $this in non-static functions
- * @return string
- */
- public static function makeLegend( IContextSource $context ) {
- global $wgRecentChangesFlags;
- $user = $context->getUser();
- # The legend showing what the letters and stuff mean
- $legend = Xml::openElement( 'dl' ) . "\n";
- # Iterates through them and gets the messages for both letter and tooltip
- $legendItems = $wgRecentChangesFlags;
- if ( !$user->useRCPatrol() ) {
- unset( $legendItems['unpatrolled'] );
- }
- foreach ( $legendItems as $key => $legendInfo ) { # generate items of the legend
- $label = $legendInfo['title'];
- $letter = $legendInfo['letter'];
- $cssClass = isset( $legendInfo['class'] ) ? $legendInfo['class'] : $key;
-
- $legend .= Xml::element( 'dt',
- array( 'class' => $cssClass ), $context->msg( $letter )->text()
- ) . "\n";
- if ( $key === 'newpage' ) {
- $legend .= Xml::openElement( 'dd' );
- $legend .= $context->msg( $label )->escaped();
- $legend .= ' ' . $context->msg( 'recentchanges-legend-newpage' )->parse();
- $legend .= Xml::closeElement( 'dd' ) . "\n";
- } else {
- $legend .= Xml::element( 'dd', array(),
- $context->msg( $label )->text()
- ) . "\n";
- }
- }
- # (+-123)
- $legend .= Xml::tags( 'dt',
- array( 'class' => 'mw-plusminus-pos' ),
- $context->msg( 'recentchanges-legend-plusminus' )->parse()
- ) . "\n";
- $legend .= Xml::element(
- 'dd',
- array( 'class' => 'mw-changeslist-legend-plusminus' ),
- $context->msg( 'recentchanges-label-plusminus' )->text()
- ) . "\n";
- $legend .= Xml::closeElement( 'dl' ) . "\n";
-
- # Collapsibility
- $legend =
- '<div class="mw-changeslist-legend">' .
- $context->msg( 'recentchanges-legend-heading' )->parse() .
- '<div class="mw-collapsible-content">' . $legend . '</div>' .
- '</div>';
-
- return $legend;
- }
-