* @param string $subpage
*/
public function execute( $subpage ) {
- global $wgStructuredChangeFiltersEnableSaving,
- $wgStructuredChangeFiltersEnableExperimentalViews;
-
// Backwards-compatibility: redirect to new feed URLs
$feedFormat = $this->getRequest()->getVal( 'feed' );
if ( !$this->including() && $feedFormat ) {
)
);
+ $experimentalStructuredChangeFilters =
+ $this->getConfig()->get( 'StructuredChangeFiltersEnableExperimentalViews' );
+
$out->addJsConfigVars( 'wgStructuredChangeFilters', $jsData['groups'] );
$out->addJsConfigVars(
'wgStructuredChangeFiltersEnableSaving',
- $wgStructuredChangeFiltersEnableSaving
+ $this->getConfig()->get( 'StructuredChangeFiltersEnableSaving' )
);
$out->addJsConfigVars(
'wgStructuredChangeFiltersEnableExperimentalViews',
- $wgStructuredChangeFiltersEnableExperimentalViews
+ $experimentalStructuredChangeFilters
+ );
+ $out->addJsConfigVars(
+ 'wgStructuredChangeFiltersEnableLiveUpdate',
+ $this->getConfig()->get( 'StructuredChangeFiltersEnableLiveUpdate' )
);
+ if ( $experimentalStructuredChangeFilters ) {
+ $out->addJsConfigVars(
+ 'wgRCFiltersChangeTags',
+ $this->buildChangeTagList()
+ );
+ }
}
}
+ /**
+ * Fetch the change tags list for the front end
+ *
+ * @return Array Tag data
+ */
+ protected function buildChangeTagList() {
+ $explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
+ $softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
+ $tagStats = ChangeTags::tagUsageStatistics();
+
+ $tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags, $tagStats );
+
+ // Sort by hits
+ arsort( $tagHitCounts );
+
+ // Build the list and data
+ $result = [];
+ foreach ( $tagHitCounts as $tagName => $hits ) {
+ if (
+ // Only get active tags
+ isset( $explicitlyDefinedTags[ $tagName ] ) ||
+ isset( $softwareActivatedTags[ $tagName ] )
+ ) {
+ // Parse description
+ $desc = ChangeTags::tagLongDescriptionMessage( $tagName, $this->getContext() );
+
+ $result[] = [
+ 'name' => $tagName,
+ 'label' => Sanitizer::stripAllTags(
+ ChangeTags::tagDescription( $tagName, $this->getContext() )
+ ),
+ 'description' => $desc ? Sanitizer::stripAllTags( $desc->parse() ) : '',
+ 'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ),
+ 'hits' => $hits,
+ ];
+ }
+ }
+
+ return $result;
+ }
+
/**
* @inheritdoc
*/
* @inheritdoc
*/
protected function buildQuery( &$tables, &$fields, &$conds,
- &$query_options, &$join_conds, FormOptions $opts ) {
-
+ &$query_options, &$join_conds, FormOptions $opts
+ ) {
$dbr = $this->getDB();
parent::buildQuery( $tables, $fields, $conds,
$query_options, $join_conds, $opts );
* @inheritdoc
*/
protected function doMainQuery( $tables, $fields, $conds, $query_options,
- $join_conds, FormOptions $opts ) {
-
+ $join_conds, FormOptions $opts
+ ) {
$dbr = $this->getDB();
$user = $this->getUser();
$userShowHiddenCats = $this->getUser()->getBoolOption( 'showhiddencats' );
$rclistOutput = $list->beginRecentChangesList();
+ if ( $this->isStructuredFilterUiEnabled() ) {
+ $rclistOutput .= $this->makeLegend();
+ }
+
foreach ( $rows as $obj ) {
if ( $limit == 0 ) {
break;
$nondefaults = $opts->getChangedValues();
$panel = [];
- $panel[] = $this->makeLegend();
+ if ( !$this->isStructuredFilterUiEnabled() ) {
+ $panel[] = $this->makeLegend();
+ }
$panel[] = $this->optionsPanel( $defaults, $nondefaults, $numRows );
$panel[] = '<hr />';