r111186 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111185‎ | r111186 | r111187 >
Date:19:29, 10 February 2012
Author:mah
Status:reverted (Comments)
Tags:
Comment:
Fixes Bug 18704 - Add an unique CSS class or ID to the tagfilter table row at RecentChanges
Patch from Jarry1250
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/includes/ChangeTags.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -568,14 +568,14 @@
569569 $submit = ' ' . Xml::submitbutton( wfMsg( 'allpagessubmit' ) );
570570
571571 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
572 - foreach( $extraOpts as $optionRow ) {
 572+ foreach( $extraOpts as $name=>$optionRow ) {
573573 # Add submit button to the last row only
574574 ++$count;
575 - $addSubmit = $count === $extraOptsCount ? $submit : '';
 575+ $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
576576
577577 $out .= Xml::openElement( 'tr' );
578578 if( is_array( $optionRow ) ) {
579 - $out .= Xml::tags( 'td', array( 'class' => 'mw-label' ), $optionRow[0] );
 579+ $out .= Xml::tags( 'td', array( 'class' => 'mw-label ' . $name . '-label' ), $optionRow[0] );
580580 $out .= Xml::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
581581 } else {
582582 $out .= Xml::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
Index: trunk/phase3/includes/ChangeTags.php
@@ -209,8 +209,8 @@
210210 if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) )
211211 return $fullForm ? '' : array();
212212
213 - $data = array( Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ) ),
214 - Xml::input( 'tagfilter', 20, $selected ) );
 213+ $data = array( Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ),
 214+ Xml::input( 'tagfilter', 20, $selected, array( 'class' => 'tagfilter-input' ) ) ) );
215215
216216 if ( !$fullForm ) {
217217 return $data;
@@ -220,6 +220,7 @@
221221 $html .= "\n" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'tag-filter-submit' ) ) );
222222 $html .= "\n" . Html::hidden( 'title', $title->getPrefixedText() );
223223 $html = Xml::tags( 'form', array( 'action' => $title->getLocalURL(), 'method' => 'get' ), $html );
 224+ $html = Xml::tags( 'form', array( 'action' => $title->getLocalURL(), 'class' => 'tagfilter-form', 'method' => 'get' ), $html );
224225
225226 return $html;
226227 }
Index: trunk/phase3/CREDITS
@@ -113,6 +113,7 @@
114114 * Harry Burt
115115 * Ireas
116116 * Jaska Zedlik
 117+* Jarry1250
117118 * Jeremy Baron
118119 * Jidanni
119120 * Jimmy Xu

Follow-up revisions

RevisionCommit summaryAuthorDate
r111226re r111186: remove extra form tag.mah01:53, 11 February 2012
r111449Reverted r111186, r111226: broken per CRaaron07:25, 14 February 2012

Comments

#Comment by Grandiose (talk | contribs)   20:39, 10 February 2012

In retrospect, I've made a simple mistake here (forgot to remove the old "$html = " line when adding the new one), perhaps someone could followup on that?

#Comment by Jarry1250 (talk | contribs)   20:40, 10 February 2012

Bleh, sorry, that was me editing from my brother's (Grandiose's) computer but forgetting to log him out first :(

#Comment by MarkAHershberger (talk | contribs)   01:51, 11 February 2012

Thanks for pointing that out. I missed it when testing this.

#Comment by Bawolff (talk | contribs)   01:29, 14 February 2012

Notice: Undefined offset: 1 in /var/www/w/phase3/includes/specials/SpecialRecentchanges.php on line 579

#Comment by Bawolff (talk | contribs)   01:40, 14 February 2012

Also, after this revision, the tag filter <input> box has dissapeared...

#Comment by Jarry1250 (talk | contribs)   17:52, 16 February 2012

What extensions are you running? I can't recreate this myself.

#Comment by Bawolff (talk | contribs)   23:58, 16 February 2012

A whole bunch - http://pastebin.com/6s217ZPC . None of them should affect RC as far as i can tell. (Sorry, that's probably not very useful for debugging).

var_dumping $extraOpts right before the foreach on SpecialRecentChanges.php

array(2) {
  ["namespace"]=>
  array(2) {
    [0]=>
    string(41) "<label for="namespace">Namespace:</label>"
    [1]=>
    string(1685) "<select id="namespace" name="namespace">
<option value="" selected="">all</option>
<option value="0">(Main)</option>
<option value="1">Talk</option>
<option value="2">User</option>
<option value="3">User talk</option>
<option value="4">Test</option>
<option value="5">Test talk</option>

<option value="6">File</option>
<option value="7">File talk</option>
<option value="8">MediaWiki</option>
<option value="9">MediaWiki talk</option>
<option value="10">Template</option>
<option value="11">Template talk</option>
<option value="12">Help</option>
<option value="13">Help talk</option>
<option value="14">Category</option>

<option value="15">Category talk</option>
<option value="20">Module</option>
<option value="21">Module talk</option>
<option value="90">Thread</option>
<option value="91">Thread talk</option>
<option value="92">Summary</option>
<option value="93">Summary talk</option>
<option value="100">Comments</option>
<option value="101">Comments talk</option>

</select> <input name="invert" type="checkbox" value="1" id="nsinvert" title="Check this box to hide changes to pages within the selected namespace (and the associated namespace if checked)" /> <label for="nsinvert" title="Check this box to hide changes to pages within the selected namespace (and the associated namespace if checked)">Invert selection</label> <input name="associated" type="checkbox" value="1" id="nsassociated" title="Check this box to also include the talk or subject namespace associated with the selected namespace" /> <label for="nsassociated" title="Check this box to also include the talk or subject namespace associated with the selected namespace">Associated namespace</label>"
  }
  ["tagfilter"]=>
  array(1) {
    [0]=>
    string(110) "<label for="tagfilter"><a href="https://www.mediawiki.org/w/phase3/index.php/Special:Tags" title="Special:Tags">Tag</a> filter:</label>"
  }
}

(which is more than a little odd. I'm not sure why that's happening).

#Comment by Jarry1250 (talk | contribs)   14:00, 17 February 2012

Okay, got the problem. My patch had the line:

+		$data = array( Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ), ),
+			Xml::input( 'tagfilter', 20, $selected, array( 'class' => 'tagfilter-input' ) ) );

Which has a stray comma (no idea how it got there). Thankfully Mark noticed this and removed it; however, in doing so, he has managed to shift one of the brackets from the first line to the second.

The correct lines should be:

+		$data = array( Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ) ),
+			Xml::input( 'tagfilter', 20, $selected, array( 'class' => 'tagfilter-input' ) ) );

That is to say, the top line shouldn't have changed at all, only the second line.

Thanks!

#Comment by Jarry1250 (talk | contribs)   14:50, 17 February 2012

(Incidentally, if someone does feel like re-committing this on my behalf, note that I'm already listed under authors under my real name.)

Status & tagging log