Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -119,6 +119,7 @@ |
120 | 120 | * mediawiki.js Message object constructor is now publicly available as mw.Message. |
121 | 121 | * (bug 29309) allow CSS class per tooltip (tipsy) |
122 | 122 | * (bug 33565) Add accesskey/tooltip to submit buttons on Special:EditWatchlist. |
| 123 | +* (bug 25909) Add a drop-down list for the tags in Recentchanges and Newpages |
123 | 124 | |
124 | 125 | === Bug fixes in 1.19 === |
125 | 126 | * $wgUploadNavigationUrl should be used for file redlinks if. |
Index: trunk/phase3/includes/ChangeTags.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | |
28 | 28 | static function tagDescription( $tag ) { |
29 | 29 | $msg = wfMessage( "tag-$tag" ); |
30 | | - return $msg->exists() ? $msg->parse() : htmlspecialchars( $tag ); |
| 30 | + return $msg->exists() ? $msg->parse() : htmlspecialchars( $tag ); |
31 | 31 | } |
32 | 32 | |
33 | 33 | ## Basic utility method to add tags to a particular change, given its rc_id, rev_id and/or log_id. |
— | — | @@ -109,7 +109,10 @@ |
110 | 110 | global $wgRequest, $wgUseTagFilter; |
111 | 111 | |
112 | 112 | if( $filter_tag === false ) { |
113 | | - $filter_tag = $wgRequest->getVal( 'tagfilter' ); |
| 113 | + $filter_tag = $wgRequest->getVal( 'tagfilterdropdown', '' ); |
| 114 | + if ( $filter_tag === '' || $filter_tag === 'other' ) { |
| 115 | + $filter_tag = $wgRequest->getVal( 'tagfilter' ); |
| 116 | + } |
114 | 117 | } |
115 | 118 | |
116 | 119 | // Figure out which conditions can be done. |
— | — | @@ -178,6 +181,45 @@ |
179 | 182 | } |
180 | 183 | |
181 | 184 | /** |
| 185 | + * Build a text box and a dropdown list to select a change tag |
| 186 | + * |
| 187 | + * @param $msgkey String: message key for the message where a (newline delimited) |
| 188 | + * list of tags can be specified. These tags will be put in the dropdown list. |
| 189 | + * If the specified message is empty, only the text field will be returned. |
| 190 | + * @param $selectedtxt String: tag to put in text box |
| 191 | + * @param $selecteddropdown String: tag to select in dropdown |
| 192 | + * @return Array of html fragments of which the first element is the label |
| 193 | + * If $wgUseTagFilter is false or there are no defined tags, an empty array is returned |
| 194 | + */ |
| 195 | + public static function buildTagFilterWithDropdown( $msgkey, $selectedtxt = '', $selecteddropdown = 'other' ) { |
| 196 | + |
| 197 | + global $wgUseTagFilter; |
| 198 | + |
| 199 | + $definedtags = self::listDefinedTags(); |
| 200 | + |
| 201 | + if ( !$wgUseTagFilter || !count( $definedtags ) ) { |
| 202 | + // no tag filter if there are no tags defined or $wgUseTagFilter is false |
| 203 | + return array(); |
| 204 | + } |
| 205 | + |
| 206 | + // Extract tags from message: one tag per line |
| 207 | + $tags = preg_split( "/\n/", wfMsgForContent( $msgkey ), -1, PREG_SPLIT_NO_EMPTY); |
| 208 | + |
| 209 | + $data[] = Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ) ); |
| 210 | + |
| 211 | + if ( count( $tags ) ) { |
| 212 | + // Add dropdown list only when message $msgkey contains at least one tag |
| 213 | + $data[] = Xml::listDropDown( 'tagfilterdropdown', implode( "\n", $tags ), |
| 214 | + wfMsgForContent( 'tag-filter-dropdown-other' ), $selecteddropdown ); |
| 215 | + } |
| 216 | + |
| 217 | + $data[] = Xml::input( 'tagfilter', 20, $selectedtxt ); |
| 218 | + |
| 219 | + return $data; |
| 220 | + |
| 221 | + } |
| 222 | + |
| 223 | + /** |
182 | 224 | *Basically lists defined tags which count even if they aren't applied to anything |
183 | 225 | * |
184 | 226 | * @return array |
Index: trunk/phase3/includes/actions/HistoryAction.php |
— | — | @@ -136,7 +136,13 @@ |
137 | 137 | $year = $request->getInt( 'year' ); |
138 | 138 | $month = $request->getInt( 'month' ); |
139 | 139 | $tagFilter = $request->getVal( 'tagfilter' ); |
140 | | - $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); |
| 140 | + $tagFilterDropdown = $request->getVal( 'tagfilterdropdown' ); |
| 141 | + $tagSelector = ChangeTags::buildTagFilterWithDropdown( |
| 142 | + 'tag-filter-dropdown-list', |
| 143 | + $tagFilter, |
| 144 | + $tagFilterDropdown |
| 145 | + ); |
| 146 | + $tagSelector = implode( ' ', $tagSelector ); |
141 | 147 | |
142 | 148 | /** |
143 | 149 | * Option to show only revisions that have been (partially) hidden via RevisionDelete |
— | — | @@ -161,14 +167,26 @@ |
162 | 168 | Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . "\n" . |
163 | 169 | Html::hidden( 'action', 'history' ) . "\n" . |
164 | 170 | Xml::dateMenu( $year, $month ) . ' ' . |
165 | | - ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) . |
166 | | - $checkDeleted . |
| 171 | + Html::rawElement( |
| 172 | + 'span', |
| 173 | + array( 'style' => 'white-space: nowrap' ), |
| 174 | + ( $tagSelector ? ( $tagSelector . ' ' ) : '' ) |
| 175 | + ) . |
| 176 | + Html::rawElement( |
| 177 | + 'span', |
| 178 | + array( 'style' => 'white-space: nowrap' ), |
| 179 | + $checkDeleted |
| 180 | + ) . |
167 | 181 | Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" . |
168 | 182 | '</fieldset></form>' |
169 | 183 | ); |
170 | 184 | |
171 | 185 | wfRunHooks( 'PageHistoryBeforeList', array( &$this->page ) ); |
172 | 186 | |
| 187 | + if ( $tagFilterDropdown !== '' && $tagFilterDropdown !== 'other' ) { |
| 188 | + $tagFilter = $tagFilterDropdown; |
| 189 | + } |
| 190 | + |
173 | 191 | // Create and output the list. |
174 | 192 | $pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds ); |
175 | 193 | $out->addHTML( |
Index: trunk/phase3/includes/specials/SpecialNewpages.php |
— | — | @@ -59,6 +59,7 @@ |
60 | 60 | $opts->add( 'username', '' ); |
61 | 61 | $opts->add( 'feed', '' ); |
62 | 62 | $opts->add( 'tagfilter', '' ); |
| 63 | + $opts->add( 'tagfilterdropdown', '' ); |
63 | 64 | |
64 | 65 | $this->customFilters = array(); |
65 | 66 | wfRunHooks( 'SpecialNewPagesFilters', array( $this, &$this->customFilters ) ); |
— | — | @@ -211,6 +212,7 @@ |
212 | 213 | $namespace = $this->opts->consumeValue( 'namespace' ); |
213 | 214 | $username = $this->opts->consumeValue( 'username' ); |
214 | 215 | $tagFilterVal = $this->opts->consumeValue( 'tagfilter' ); |
| 216 | + $tagFilterDropdownVal = $this->opts->consumeValue( 'tagfilterdropdown' ); |
215 | 217 | |
216 | 218 | // Check username input validity |
217 | 219 | $ut = Title::makeTitleSafe( NS_USER, $username ); |
— | — | @@ -223,9 +225,14 @@ |
224 | 226 | } |
225 | 227 | $hidden = implode( "\n", $hidden ); |
226 | 228 | |
227 | | - $tagFilter = ChangeTags::buildTagFilterSelector( $tagFilterVal ); |
| 229 | + $tagFilter = ChangeTags::buildTagFilterWithDropdown( |
| 230 | + 'tag-filter-newpages-dropdown-list', |
| 231 | + $tagFilterVal, |
| 232 | + $tagFilterDropdownVal |
| 233 | + ); |
228 | 234 | if ( $tagFilter ) { |
229 | | - list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter; |
| 235 | + $tagFilterLabel = array_shift( $tagFilter ); |
| 236 | + $tagFilterSelector = implode( ' ', $tagFilter ); |
230 | 237 | } |
231 | 238 | |
232 | 239 | $form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . |
— | — | @@ -533,8 +540,7 @@ |
534 | 541 | $fields, |
535 | 542 | $info['conds'], |
536 | 543 | $info['join_conds'], |
537 | | - $info['options'], |
538 | | - $this->opts['tagfilter'] |
| 544 | + $info['options'] |
539 | 545 | ); |
540 | 546 | |
541 | 547 | return $info; |
Index: trunk/phase3/includes/specials/SpecialRecentchanges.php |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | $opts->add( 'categories', '' ); |
62 | 62 | $opts->add( 'categories_any', false ); |
63 | 63 | $opts->add( 'tagfilter', '' ); |
| 64 | + $opts->add( 'tagfilterdropdown', '' ); |
64 | 65 | return $opts; |
65 | 66 | } |
66 | 67 | |
— | — | @@ -400,8 +401,7 @@ |
401 | 402 | // Tag stuff. |
402 | 403 | // Doesn't work when transcluding. See bug 23293 |
403 | 404 | ChangeTags::modifyDisplayQuery( |
404 | | - $tables, $fields, $conds, $join_conds, $query_options, |
405 | | - $opts['tagfilter'] |
| 405 | + $tables, $fields, $conds, $join_conds, $query_options |
406 | 406 | ); |
407 | 407 | } |
408 | 408 | |
— | — | @@ -554,7 +554,7 @@ |
555 | 555 | $nondefaults = $opts->getChangedValues(); |
556 | 556 | $opts->consumeValues( array( |
557 | 557 | 'namespace', 'invert', 'associated', 'tagfilter', |
558 | | - 'categories', 'categories_any' |
| 558 | + 'categories', 'categories_any', 'tagfilterdropdown' |
559 | 559 | ) ); |
560 | 560 | |
561 | 561 | $panel = array(); |
— | — | @@ -616,9 +616,10 @@ |
617 | 617 | $extraOpts['category'] = $this->categoryFilterForm( $opts ); |
618 | 618 | } |
619 | 619 | |
620 | | - $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] ); |
| 620 | + $tagFilter = ChangeTags::buildTagFilterWithDropdown( 'tag-filter-dropdown-list', |
| 621 | + $opts['tagfilter'], $opts['tagfilterdropdown'] ); |
621 | 622 | if ( count( $tagFilter ) ) { |
622 | | - $extraOpts['tagfilter'] = $tagFilter; |
| 623 | + $extraOpts['tagfilter'] = implode( ' ', $tagFilter ); |
623 | 624 | } |
624 | 625 | |
625 | 626 | wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) ); |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -103,6 +103,7 @@ |
104 | 104 | $this->opts['nsInvert'] = (bool) $request->getVal( 'nsInvert' ); |
105 | 105 | |
106 | 106 | $this->opts['tagfilter'] = (string) $request->getVal( 'tagfilter' ); |
| 107 | + $this->opts['tagfilterdropdown'] = (string) $request->getVal( 'tagfilterdropdown' ); |
107 | 108 | |
108 | 109 | // Allows reverts to have the bot flag in recent changes. It is just here to |
109 | 110 | // be passed in the form at the top of the page |
— | — | @@ -138,6 +139,9 @@ |
139 | 140 | if ( $this->opts['tagfilter'] !== '' ) { |
140 | 141 | $apiParams['tagfilter'] = $this->opts['tagfilter']; |
141 | 142 | } |
| 143 | + if ( $this->opts['tagfilterdropdown'] !== '' && $this->opts['tagfilterdropdown'] !== 'other' ) { |
| 144 | + $apiParams['tagfilter'] = $this->opts['tagfilterdropdown']; |
| 145 | + } |
142 | 146 | if ( $this->opts['namespace'] !== '' ) { |
143 | 147 | $apiParams['namespace'] = $this->opts['namespace']; |
144 | 148 | } |
— | — | @@ -399,7 +403,11 @@ |
400 | 404 | $form .= "\t" . Html::hidden( $name, $value ) . "\n"; |
401 | 405 | } |
402 | 406 | |
403 | | - $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] ); |
| 407 | + $tagFilter = ChangeTags::buildTagFilterWithDropdown( |
| 408 | + 'tag-filter-dropdown-list', |
| 409 | + $this->opts['tagfilter'], |
| 410 | + $this->opts['tagfilterdropdown'] |
| 411 | + ); |
404 | 412 | |
405 | 413 | if ( $tagFilter ) { |
406 | 414 | $filterSelection = |
Index: trunk/phase3/languages/messages/MessagesQqq.php |
— | — | @@ -4428,7 +4428,13 @@ |
4429 | 4429 | 'tags-hitcount' => 'Shown in the “Tagged changes” column in [[Special:Tags]]. For more information on tags see [//www.mediawiki.org/wiki/Manual:Tags Mediawiki]. |
4430 | 4430 | |
4431 | 4431 | * <code>$1</code> is the number of changes marked with the tag', |
| 4432 | +'tag-filter-dropdown-list' => 'A list of change tags to put in a dropdown list for selecting a tag to filter by.', |
| 4433 | +'tag-filter-newpages-dropdown-list' => 'A list of change tags to put in a dropdown list for selecting a tag to filter by on [[Special:NewPages]].', |
| 4434 | +'tag-filter-dropdown-other' => 'The "other" option in the dropdown list for selecting a tag to filter by. When a user selects this, he can type any tag in the text field next to it. |
4432 | 4435 | |
| 4436 | +{{Identical|Other}} |
| 4437 | +', |
| 4438 | + |
4433 | 4439 | # Special:ComparePages |
4434 | 4440 | 'comparepages' => 'The title of [[Special:ComparePages]]', |
4435 | 4441 | 'compare-selector' => 'Header of the form on [[Special:ComparePages]]', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -4634,6 +4634,9 @@ |
4635 | 4635 | 'tags-hitcount-header' => 'Tagged changes', |
4636 | 4636 | 'tags-edit' => 'edit', |
4637 | 4637 | 'tags-hitcount' => '$1 {{PLURAL:$1|change|changes}}', |
| 4638 | +'tag-filter-dropdown-other' => 'Other:', |
| 4639 | +'tag-filter-dropdown-list' => '', |
| 4640 | +'tag-filter-newpages-dropdown-list' => '', |
4638 | 4641 | |
4639 | 4642 | # Special:ComparePages |
4640 | 4643 | 'comparepages' => 'Compare pages', |