'HTMLSelectField' => 'includes/htmlform/HTMLSelectField.php',
'HTMLSelectLimitField' => 'includes/htmlform/HTMLSelectLimitField.php',
'HTMLSelectOrOtherField' => 'includes/htmlform/HTMLSelectOrOtherField.php',
+ 'HTMLSelectNamespace' => 'includes/htmlform/HTMLSelectNamespace.php',
+ 'HTMLTagFilter' => 'includes/htmlform/HTMLTagFilter.php',
'HTMLSubmitField' => 'includes/htmlform/HTMLSubmitField.php',
'HTMLTextAreaField' => 'includes/htmlform/HTMLTextAreaField.php',
'HTMLTextField' => 'includes/htmlform/HTMLTextField.php',
$wgTrackingCategories = array(
'index-category',
'noindex-category',
+ 'duplicate-args-category',
'expensive-parserfunction-category',
'post-expand-template-argument-category',
'post-expand-template-inclusion-category',
public function getAllowedParams() {
return array(
'xslt' => array(
- ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-callback',
+ ApiBase::PARAM_HELP_MSG => 'apihelp-xml-param-xslt',
),
'includexmlnamespace' => array(
ApiBase::PARAM_DFLT => false,
- ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-callback',
+ ApiBase::PARAM_HELP_MSG => 'apihelp-xml-param-includexmlnamespace',
),
);
}
"apihelp-wddxfm-description": "Output data in WDDX format (pretty-print in HTML).",
"apihelp-xml-description": "Output data in XML format.",
"apihelp-xml-param-xslt": "If specified, adds <xslt> as stylesheet. This should be a wiki page in the MediaWiki namespace whose page name ends with \".xsl\".",
- "apihelp-xml-param-includexmlnamespac": "If specified, adds an XML namespace.",
+ "apihelp-xml-param-includexmlnamespace": "If specified, adds an XML namespace.",
"apihelp-xmlfm-description": "Output data in XML format (pretty-print in HTML).",
"apihelp-yaml-description": "Output data in YAML format.",
"apihelp-yamlfm-description": "Output data in YAML format (pretty-print in HTML).",
"apihelp-wddxfm-description": "{{doc-apihelp-description|wddxfm|seealso=* {{msg-mw|apihelp-wddx-description}}}}",
"apihelp-xml-description": "{{doc-apihelp-description|xml|seealso=* {{msg-mw|apihelp-xmlfm-description}}}}",
"apihelp-xml-param-xslt": "{{doc-apihelp-param|xml|xslt}}",
- "apihelp-xml-param-includexmlnamespac": "{{doc-apihelp-param|xml|includexmlnamespac}}",
+ "apihelp-xml-param-includexmlnamespace": "{{doc-apihelp-param|xml|includexmlnamespace}}",
"apihelp-xmlfm-description": "{{doc-apihelp-description|xmlfm|seealso=* {{msg-mw|apihelp-xml-description}}}}",
"apihelp-yaml-description": "{{doc-apihelp-description|yaml|seealso=* {{msg-mw|apihelp-yamlfm-description}}}}",
"apihelp-yamlfm-description": "{{doc-apihelp-description|yamlfm|seealso=* {{msg-mw|apihelp-yaml-description}}}}",
# Split database and table into proper variables.
# We reverse the explode so that database.table and table both output
# the correct table.
- $dbDetails = explode( '.', $name, 2 );
+ $dbDetails = explode( '.', $name, 3 );
if ( count( $dbDetails ) == 3 ) {
list( $database, $schema, $table ) = $dbDetails;
# We don't want any prefix added in this case
'info' => 'HTMLInfoField',
'selectorother' => 'HTMLSelectOrOtherField',
'selectandother' => 'HTMLSelectAndOtherField',
+ 'namespaceselect' => 'HTMLSelectNamespace',
+ 'tagfilter' => 'HTMLTagFilter',
'submit' => 'HTMLSubmitField',
'hidden' => 'HTMLHiddenField',
'edittools' => 'HTMLEditTools',
--- /dev/null
+<?php
+/**
+ * Wrapper for Html::namespaceSelector to use in HTMLForm
+ */
+class HTMLSelectNamespace extends HTMLFormField {
+ function getInputHTML( $value ) {
+ return Html::namespaceSelector(
+ array(
+ 'selected' => $value,
+ 'all' => 'all'
+ ), array(
+ 'name' => $this->mName,
+ 'id' => $this->mID,
+ 'class' => 'namespaceselector',
+ )
+ );
+ }
+}
--- /dev/null
+<?php
+/**
+ * Wrapper for ChgangeTags::buildTagFilterSelector to use in HTMLForm
+ */
+class HTMLTagFilter extends HTMLFormField {
+ function getInputHTML( $value ) {
+ $tagFilter = ChangeTags::buildTagFilterSelector( $value );
+ if ( $tagFilter ) {
+ list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter;
+ // we only need the select field, HTMLForm should handle the label
+ return $tagFilterSelector;
+ }
+ return;
+ }
+}
return true;
}
+ /**
+ * Delete content of shard tables in every server.
+ * Return true if the operation is successful, false otherwise.
+ * @return bool
+ */
public function deleteAll() {
for ( $serverIndex = 0; $serverIndex < $this->numServers; $serverIndex++ ) {
try {
// Numbered parameter
$index = $nameNodes->item( 0 )->attributes->getNamedItem( 'index' )->textContent;
$index = $index - $indexOffset;
+ if ( isset( $namedArgs[$index] ) || isset( $numberedArgs[$index] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$numberedArgs[$index] = $value->item( 0 );
unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $nameNodes->item( 0 ), PPFrame::STRIP_COMMENTS ) );
+ if ( isset( $namedArgs[$name] ) || isset( $numberedArgs[$name] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$namedArgs[$name] = $value->item( 0 );
unset( $numberedArgs[$name] );
}
if ( $bits['index'] !== '' ) {
// Numbered parameter
$index = $bits['index'] - $indexOffset;
+ if ( isset( $namedArgs[$index] ) || isset( $numberedArgs[$index] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$numberedArgs[$index] = $bits['value'];
unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
+ if ( isset( $namedArgs[$name] ) || isset( $numberedArgs[$name] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$namedArgs[$name] = $bits['value'];
unset( $numberedArgs[$name] );
}
}
protected function form() {
+ $out = $this->getOutput();
// Consume values
$this->opts->consumeValue( 'offset' ); // don't carry offset, DWIW
$namespace = $this->opts->consumeValue( 'namespace' );
}
$hidden = implode( "\n", $hidden );
- $tagFilter = ChangeTags::buildTagFilterSelector( $tagFilterVal );
- if ( $tagFilter ) {
- list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter;
- }
+ $form = array(
+ 'namespace' => array(
+ 'type' => 'namespaceselect',
+ 'name' => 'namespace',
+ 'label-message' => 'namespace',
+ 'default' => $namespace,
+ ),
+ 'nsinvert' => array(
+ 'type' => 'check',
+ 'name' => 'nsinvert',
+ 'label-message' => 'invert',
+ 'default' => $nsinvert,
+ 'tooltip' => $this->msg( 'tooltip-invert' )->text(),
+ ),
+ 'tagFilter' => array(
+ 'type' => 'tagfilter',
+ 'name' => 'tagfilter',
+ 'label-raw' => wfMessage( 'tag-filter' )->parse(),
+ 'default' => $tagFilterVal,
+ ),
+ 'username' => array(
+ 'type' => 'text',
+ 'name' => 'username',
+ 'label-message' => 'newpages-username',
+ 'default' => $userText,
+ 'id' => 'mw-np-username',
+ 'size' => 30,
+ 'cssclass' => 'mw-autocomplete-user', // used by mediawiki.userSuggest
+ ),
+ );
+
+ $htmlForm = new HTMLForm( $form, $this->getContext() );
+
+ $htmlForm->setSubmitText( $this->msg( 'allpagessubmit' )->text() );
+ $htmlForm->setSubmitProgressive();
+ // The form should be visible on each request (inclusive requests with submitted forms), so
+ // return always false here.
+ $htmlForm->setSubmitCallback(
+ function() {
+ return false;
+ }
+ );
+ $htmlForm->setMethod( 'get' );
+
+ $out->addHtml( Xml::fieldset( $this->msg( 'newpages' )->text() ) );
- $this->getOutput()->addModules( 'mediawiki.userSuggest' );
-
- $form = Xml::openElement( 'form', array( 'action' => wfScript() ) ) .
- Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) .
- Xml::fieldset( $this->msg( 'newpages' )->text() ) .
- Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) .
- '<tr>
- <td class="mw-label">' .
- Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) .
- '</td>
- <td class="mw-input">' .
- Html::namespaceSelector(
- array(
- 'selected' => $namespace,
- 'all' => 'all',
- ), array(
- 'name' => 'namespace',
- 'id' => 'namespace',
- 'class' => 'namespaceselector',
- )
- ) . ' ' .
- Xml::checkLabel(
- $this->msg( 'invert' )->text(),
- 'invert',
- 'nsinvert',
- $nsinvert,
- array( 'title' => $this->msg( 'tooltip-invert' )->text() )
+ $htmlForm->show();
+
+ $out->addHtml(
+ Html::rawElement(
+ 'div',
+ null,
+ $this->filterLinks()
) .
- '</td>
- </tr>' . ( $tagFilter ? (
- '<tr>
- <td class="mw-label">' .
- $tagFilterLabel .
- '</td>
- <td class="mw-input">' .
- $tagFilterSelector .
- '</td>
- </tr>' ) : '' ) .
- '<tr>
- <td class="mw-label">' .
- Xml::label( $this->msg( 'newpages-username' )->text(), 'mw-np-username' ) .
- '</td>
- <td class="mw-input">' .
- Xml::input( 'username', 30, $userText, array(
- 'id' => 'mw-np-username',
- 'class' => 'mw-autocomplete-user', // used by mediawiki.userSuggest
- ) ) .
- '</td>
- </tr>' .
- '<tr> <td></td>
- <td class="mw-submit">' .
- Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) .
- '</td>
- </tr>' .
- '<tr>
- <td></td>
- <td class="mw-input">' .
- $this->filterLinks() .
- '</td>
- </tr>' .
- Xml::closeElement( 'table' ) .
- Xml::closeElement( 'fieldset' ) .
- $hidden .
- Xml::closeElement( 'form' );
-
- $this->getOutput()->addHTML( $form );
+ Xml::closeElement( 'fieldset' )
+ );
}
/**
"content-model-text": "plain text",
"content-model-javascript": "JavaScript",
"content-model-css": "CSS",
+ "duplicate-args-category": "Pages using duplicate arguments in template calls",
+ "duplicate-args-category-desc": "The page contains template calls that use duplicates of arguments, such as <code><nowiki>{{foo|bar=1|bar=2}}</nowiki></code> or <code><nowiki>{{foo|bar|1=baz}}</nowiki></code>.",
"expensive-parserfunction-warning": "<strong>Warning:</strong> This page contains too many expensive parser function calls.\n\nIt should have less than $2 {{PLURAL:$2|call|calls}}, there {{PLURAL:$1|is now $1 call|are now $1 calls}}.",
"expensive-parserfunction-category": "Pages with too many expensive parser function calls",
"post-expand-template-inclusion-warning": "<strong>Warning:</strong> Template include size is too large.\nSome templates will not be included.",
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:28Z
+ * Date: 2014-10-15T22:50:09Z
*/
/* @noflip */
.oo-ui-rtl {
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:17Z
+ * Date: 2014-10-15T22:49:59Z
*/
/* Instantiation */
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:28Z
+ * Date: 2014-10-15T22:50:09Z
*/
/* @noflip */
.oo-ui-rtl {
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:28Z
+ * Date: 2014-10-15T22:50:09Z
*/
/* @noflip */
.oo-ui-rtl {
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:17Z
+ * Date: 2014-10-15T22:49:59Z
*/
/**
* @class
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:28Z
+ * Date: 2014-10-15T22:50:09Z
*/
/* @noflip */
.oo-ui-rtl {
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:28Z
+ * Date: 2014-10-15T22:50:09Z
*/
/* @noflip */
.oo-ui-rtl {
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:17Z
+ * Date: 2014-10-15T22:49:59Z
*/
/* Instantiation */
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:28Z
+ * Date: 2014-10-15T22:50:09Z
*/
/* @noflip */
.oo-ui-rtl {
/*!
- * OOjs UI v0.1.0-pre (d74a46ca6a)
+ * OOjs UI v0.1.0-pre (1829141230)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-10-15T00:40:17Z
+ * Date: 2014-10-15T22:49:59Z
*/
( function ( OO ) {
visible = ( visible === undefined ? !this.visible : !!visible ) && !!this.items.length;
var i, len,
- change = visible !== this.isVisible();
+ change = visible !== this.isVisible(),
+ elementDoc = this.getElementDocument(),
+ widgetDoc = this.$widget ? this.$widget[0].ownerDocument : null;
// Parent method
OO.ui.MenuWidget.super.prototype.toggle.call( this, visible );
// Auto-hide
if ( this.autoHide ) {
- this.getElementDocument().addEventListener(
+ elementDoc.addEventListener(
'mousedown', this.onDocumentMouseDownHandler, true
);
+ // Support $widget being in a different document
+ if ( widgetDoc && widgetDoc !== elementDoc ) {
+ widgetDoc.addEventListener(
+ 'mousedown', this.onDocumentMouseDownHandler, true
+ );
+ }
}
} else {
this.unbindKeyDownListener();
this.$previousFocus[0].focus();
this.$previousFocus = null;
}
- this.getElementDocument().removeEventListener(
+ elementDoc.removeEventListener(
'mousedown', this.onDocumentMouseDownHandler, true
);
+ // Support $widget being in a different document
+ if ( widgetDoc && widgetDoc !== elementDoc ) {
+ widgetDoc.removeEventListener(
+ 'mousedown', this.onDocumentMouseDownHandler, true
+ );
+ }
this.toggleClipping( false );
}
}
* @inheritdoc
*/
OO.ui.TextInputMenuWidget.prototype.toggle = function ( visible ) {
- visible = !!visible;
+ visible = visible === undefined ? !this.isVisible() : !!visible;
var change = visible !== this.isVisible();