r50714 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50713‎ | r50714 | r50715 >
Date:01:12, 18 May 2009
Author:soxred93
Status:ok (Comments)
Tags:
Comment:
Watchlist now has a specialized <div> tag that contains a unique class for each page
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -25,6 +25,7 @@
2626 class ChangesList {
2727 # Called by history lists and recent changes
2828 public $skin;
 29+ protected $watchlist = false;
2930
3031 /**
3132 * Changeslist contructor
@@ -52,6 +53,14 @@
5354 return $list;
5455 }
5556 }
 57+
 58+ /**
 59+ * Sets the list to use a <div class="watchlist-(namespace)-(page)"> tag
 60+ * @param bool $value
 61+ */
 62+ public function setWatchlistDivs( $value = true ) {
 63+ $this->watchlist = $value;
 64+ }
5665
5766 /**
5867 * As we use the same small set of messages in various methods and that
@@ -447,11 +456,19 @@
448457 $s .= ' ' . wfMsgExt( 'number_of_watching_users_RCview',
449458 array( 'parsemag', 'escape' ), $wgLang->formatNum( $rc->numberofWatchingusers ) );
450459 }
 460+
 461+ if( $this->watchlist ) {
 462+ $watchlist_start = Xml::openElement( 'div', array( 'class' => Sanitizer::escapeClass( 'watchlist-'.$rc->mAttribs['rc_namespace'].'-'.$rc->mAttribs['rc_title'] ) ) );
 463+ $watchlist_end = Xml::closeElement( 'div' );
 464+ }
 465+ else {
 466+ $watchlist_start = $watchlist_end = null;
 467+ }
451468
452469 wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) );
453470
454471 wfProfileOut( __METHOD__ );
455 - return "$dateheader<li class=\"".implode( ' ', $classes )."\">$s</li>\n";
 472+ return "$dateheader<li class=\"".implode( ' ', $classes )."\">".$watchlist_start.$s.$watchlist_end."</li>\n";
456473 }
457474 }
458475
Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -334,7 +334,8 @@
335335 $dbr->dataSeek( $res, 0 );
336336
337337 $list = ChangesList::newFromUser( $wgUser );
338 -
 338+ $list->setWatchlistDivs();
 339+
339340 $s = $list->beginRecentChangesList();
340341 $counter = 1;
341342 while ( $obj = $dbr->fetchObject( $res ) ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -54,6 +54,7 @@
5555 * (bug 18466) Add note or warning when overruling a move (semi-)protection
5656 * (bug 18342) insertTags works in edit summary box
5757 * (bug 18411) The upload form also checks post_max_size
 58+* Watchlist now has a specialized <div> tag that contains a unique class for each page
5859
5960 === Bug fixes in 1.16 ===
6061

Follow-up revisions

RevisionCommit summaryAuthorDate
r51007Modification of r50714, adding element to the li class, rather than a separat...soxred9311:03, 26 May 2009

Comments

#Comment by Nikerabbit (talk | contribs)   09:23, 18 May 2009

For which purpose?

#Comment by Ms2ger (talk | contribs)   10:05, 21 May 2009

If this is necessary, why can't the class be added to the |li| element, instead of adding yet another |div|?

#Comment by X! (talk | contribs)   10:57, 26 May 2009

This is so users can add a unique CSS class to their monobook.css to hide watchlist entries, rather than relying on hacky AJAX solutions.

#Comment by X! (talk | contribs)   11:04, 26 May 2009

Ms2ger, fixed in r51007

Status & tagging log