r76342 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76341‎ | r76342 | r76343 >
Date:21:21, 8 November 2010
Author:raymond
Status:ok (Comments)
Tags:
Comment:
Add CSS classes (including namespace and pagename) to the enhanced recent changes/watchlist entries
The old RC/WL have such classes since ages.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/ChangesList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -593,7 +593,7 @@
594594 # Process current cache
595595 $ret = $this->recentChangesBlock();
596596 $this->rc_cache = array();
597 - $ret .= Xml::element( 'h4', null, $date );
 597+ $ret .= Xml::element( 'h4', null, $date ) . "\n";
598598 $this->lastdate = $date;
599599 }
600600
@@ -736,7 +736,15 @@
737737
738738 wfProfileIn( __METHOD__ );
739739
740 - $r = '<table class="mw-enhanced-rc"><tr>';
 740+ # Add the namespace and title of the block as part of the class
 741+ if ( $block[0]->mAttribs['rc_log_type'] ) {
 742+ # Log entry
 743+ $classes = Sanitizer::escapeClass( 'mw-enhanced-rc mw-changeslist-log-' . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] );
 744+ } else {
 745+ $classes = Sanitizer::escapeClass( 'mw-enhanced-rc mw-changeslist-ns' . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
 746+ }
 747+ $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
 748+ Html::openElement( 'tr' );
741749
742750 # Collate list of users
743751 $userlinks = array();
@@ -1051,7 +1059,15 @@
10521060 extract( $rcObj->mAttribs );
10531061 $query['curid'] = $rc_cur_id;
10541062
1055 - $r = '<table class="mw-enhanced-rc"><tr>';
 1063+ if( $rc_log_type ) {
 1064+ # Log entry
 1065+ $classes = Sanitizer::escapeClass( 'mw-enhanced-rc mw-changeslist-log-' . $rc_log_type . '-' . $rcObj->mAttribs['rc_title'] );
 1066+ } else {
 1067+ $classes = Sanitizer::escapeClass( 'mw-enhanced-rc mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
 1068+ }
 1069+ $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
 1070+ Html::openElement( 'tr' );
 1071+
10561072 $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow() . '&#160;';
10571073 # Flag and Timestamp
10581074 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -199,6 +199,8 @@
200200 * (bug 20627) Installer should be in languages other than English
201201 * Support for metadata in SVG files (title, description).
202202 * Special:Search: Add CSS classes to 'none found' and 'create link' messages
 203+* Add CSS classes (including namespace and pagename) to the enhanced recent
 204+ changes/watchlist entries
203205
204206 === Bug fixes in 1.17 ===
205207 * (bug 17560) Half-broken deletion moved image files to deletion archive

Follow-up revisions

RevisionCommit summaryAuthorDate
r76382Fix per Brion's CR r76342: Avoid spaces get normalized between the 2 differen...raymond08:07, 9 November 2010

Comments

#Comment by Brion VIBBER (talk | contribs)   03:16, 9 November 2010

This looks really wrong; wrapping multiple classes through Sanitizer::escapeClass() means you end up with one class on the outside, as the spaces get normalized:

<table class="mw-enhanced-rc_mw-changeslist-ns0-Main_Page">
#Comment by Raymond (talk | contribs)   08:08, 9 November 2010

Thanks for CR. Fixed in r76382.

Status & tagging log