* mediawiki.js Message object constructor is now publicly available as mw.Message.
* (bug 29309) allow CSS class per tooltip (tipsy)
* (bug 33565) Add accesskey/tooltip to submit buttons on Special:EditWatchlist.
+* (bug 25909) Add a drop-down list for the tags in Recentchanges and Newpages
=== Bug fixes in 1.19 ===
* $wgUploadNavigationUrl should be used for file redlinks if.
static function tagDescription( $tag ) {
$msg = wfMessage( "tag-$tag" );
- return $msg->exists() ? $msg->parse() : htmlspecialchars( $tag );
+ return $msg->exists() ? $msg->parse() : htmlspecialchars( $tag );
}
## Basic utility method to add tags to a particular change, given its rc_id, rev_id and/or log_id.
global $wgRequest, $wgUseTagFilter;
if( $filter_tag === false ) {
- $filter_tag = $wgRequest->getVal( 'tagfilter' );
+ $filter_tag = $wgRequest->getVal( 'tagfilterdropdown', '' );
+ if ( $filter_tag === '' || $filter_tag === 'other' ) {
+ $filter_tag = $wgRequest->getVal( 'tagfilter' );
+ }
}
// Figure out which conditions can be done.
return $html;
}
+ /**
+ * Build a text box and a dropdown list to select a change tag
+ *
+ * @param $msgkey String: message key for the message where a (newline delimited)
+ * list of tags can be specified. These tags will be put in the dropdown list.
+ * If the specified message is empty, only the text field will be returned.
+ * @param $selectedtxt String: tag to put in text box
+ * @param $selecteddropdown String: tag to select in dropdown
+ * @return Array of html fragments of which the first element is the label
+ * If $wgUseTagFilter is false or there are no defined tags, an empty array is returned
+ */
+ public static function buildTagFilterWithDropdown( $msgkey, $selectedtxt = '', $selecteddropdown = 'other' ) {
+
+ global $wgUseTagFilter;
+
+ $definedtags = self::listDefinedTags();
+
+ if ( !$wgUseTagFilter || !count( $definedtags ) ) {
+ // no tag filter if there are no tags defined or $wgUseTagFilter is false
+ return array();
+ }
+
+ // Extract tags from message: one tag per line
+ $tags = preg_split( "/\n/", wfMsgForContent( $msgkey ), -1, PREG_SPLIT_NO_EMPTY);
+
+ $data[] = Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ) );
+
+ if ( count( $tags ) ) {
+ // Add dropdown list only when message $msgkey contains at least one tag
+ $data[] = Xml::listDropDown( 'tagfilterdropdown', implode( "\n", $tags ),
+ wfMsgForContent( 'tag-filter-dropdown-other' ), $selecteddropdown );
+ }
+
+ $data[] = Xml::input( 'tagfilter', 20, $selectedtxt );
+
+ return $data;
+
+ }
+
/**
*Basically lists defined tags which count even if they aren't applied to anything
*
$year = $request->getInt( 'year' );
$month = $request->getInt( 'month' );
$tagFilter = $request->getVal( 'tagfilter' );
- $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
+ $tagFilterDropdown = $request->getVal( 'tagfilterdropdown' );
+ $tagSelector = ChangeTags::buildTagFilterWithDropdown(
+ 'tag-filter-dropdown-list',
+ $tagFilter,
+ $tagFilterDropdown
+ );
+ $tagSelector = implode( ' ', $tagSelector );
/**
* Option to show only revisions that have been (partially) hidden via RevisionDelete
Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . "\n" .
Html::hidden( 'action', 'history' ) . "\n" .
Xml::dateMenu( $year, $month ) . ' ' .
- ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) .
- $checkDeleted .
+ Html::rawElement(
+ 'span',
+ array( 'style' => 'white-space: nowrap' ),
+ ( $tagSelector ? ( $tagSelector . ' ' ) : '' )
+ ) .
+ Html::rawElement(
+ 'span',
+ array( 'style' => 'white-space: nowrap' ),
+ $checkDeleted
+ ) .
Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" .
'</fieldset></form>'
);
wfRunHooks( 'PageHistoryBeforeList', array( &$this->page ) );
+ if ( $tagFilterDropdown !== '' && $tagFilterDropdown !== 'other' ) {
+ $tagFilter = $tagFilterDropdown;
+ }
+
// Create and output the list.
$pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds );
$out->addHTML(
$this->opts['nsInvert'] = (bool) $request->getVal( 'nsInvert' );
$this->opts['tagfilter'] = (string) $request->getVal( 'tagfilter' );
+ $this->opts['tagfilterdropdown'] = (string) $request->getVal( 'tagfilterdropdown' );
// Allows reverts to have the bot flag in recent changes. It is just here to
// be passed in the form at the top of the page
if ( $this->opts['tagfilter'] !== '' ) {
$apiParams['tagfilter'] = $this->opts['tagfilter'];
}
+ if ( $this->opts['tagfilterdropdown'] !== '' && $this->opts['tagfilterdropdown'] !== 'other' ) {
+ $apiParams['tagfilter'] = $this->opts['tagfilterdropdown'];
+ }
if ( $this->opts['namespace'] !== '' ) {
$apiParams['namespace'] = $this->opts['namespace'];
}
$form .= "\t" . Html::hidden( $name, $value ) . "\n";
}
- $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
+ $tagFilter = ChangeTags::buildTagFilterWithDropdown(
+ 'tag-filter-dropdown-list',
+ $this->opts['tagfilter'],
+ $this->opts['tagfilterdropdown']
+ );
if ( $tagFilter ) {
$filterSelection =
$opts->add( 'username', '' );
$opts->add( 'feed', '' );
$opts->add( 'tagfilter', '' );
+ $opts->add( 'tagfilterdropdown', '' );
$this->customFilters = array();
wfRunHooks( 'SpecialNewPagesFilters', array( $this, &$this->customFilters ) );
$namespace = $this->opts->consumeValue( 'namespace' );
$username = $this->opts->consumeValue( 'username' );
$tagFilterVal = $this->opts->consumeValue( 'tagfilter' );
+ $tagFilterDropdownVal = $this->opts->consumeValue( 'tagfilterdropdown' );
// Check username input validity
$ut = Title::makeTitleSafe( NS_USER, $username );
}
$hidden = implode( "\n", $hidden );
- $tagFilter = ChangeTags::buildTagFilterSelector( $tagFilterVal );
+ $tagFilter = ChangeTags::buildTagFilterWithDropdown(
+ 'tag-filter-newpages-dropdown-list',
+ $tagFilterVal,
+ $tagFilterDropdownVal
+ );
if ( $tagFilter ) {
- list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter;
+ $tagFilterLabel = array_shift( $tagFilter );
+ $tagFilterSelector = implode( ' ', $tagFilter );
}
$form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
$fields,
$info['conds'],
$info['join_conds'],
- $info['options'],
- $this->opts['tagfilter']
+ $info['options']
);
return $info;
$opts->add( 'categories', '' );
$opts->add( 'categories_any', false );
$opts->add( 'tagfilter', '' );
+ $opts->add( 'tagfilterdropdown', '' );
return $opts;
}
// Tag stuff.
// Doesn't work when transcluding. See bug 23293
ChangeTags::modifyDisplayQuery(
- $tables, $fields, $conds, $join_conds, $query_options,
- $opts['tagfilter']
+ $tables, $fields, $conds, $join_conds, $query_options
);
}
$nondefaults = $opts->getChangedValues();
$opts->consumeValues( array(
'namespace', 'invert', 'associated', 'tagfilter',
- 'categories', 'categories_any'
+ 'categories', 'categories_any', 'tagfilterdropdown'
) );
$panel = array();
$extraOpts['category'] = $this->categoryFilterForm( $opts );
}
- $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
+ $tagFilter = ChangeTags::buildTagFilterWithDropdown( 'tag-filter-dropdown-list',
+ $opts['tagfilter'], $opts['tagfilterdropdown'] );
if ( count( $tagFilter ) ) {
- $extraOpts['tagfilter'] = $tagFilter;
+ $extraOpts['tagfilter'] = implode( ' ', $tagFilter );
}
wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
'tags-hitcount-header' => 'Tagged changes',
'tags-edit' => 'edit',
'tags-hitcount' => '$1 {{PLURAL:$1|change|changes}}',
+'tag-filter-dropdown-other' => 'Other:',
+'tag-filter-dropdown-list' => '',
+'tag-filter-newpages-dropdown-list' => '',
# Special:ComparePages
'comparepages' => 'Compare pages',
'tags-hitcount' => 'Shown in the “Tagged changes” column in [[Special:Tags]]. For more information on tags see [//www.mediawiki.org/wiki/Manual:Tags Mediawiki].
* <code>$1</code> is the number of changes marked with the tag',
+'tag-filter-dropdown-list' => 'A list of change tags to put in a dropdown list for selecting a tag to filter by.',
+'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]].',
+'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.
+
+{{Identical|Other}}
+',
# Special:ComparePages
'comparepages' => 'The title of [[Special:ComparePages]]',