Commit graph

422 commits

Author SHA1 Message Date
Alangi Derick
f6fcb74728 htmlform: Fix multiple PHPDoc annotations in htmlform module
- Add @param annotation for $params variable for __construct() method
  in the HTMLExpiryField class.
- Add @throws annotation for getOptionsOOUI() method that throws a
  MWException and remove "@return array" as this method only throw an
  exception now.

Change-Id: I292f6ae04b840f6f6f74b7c92f834f056659fbe2
2018-12-03 12:48:53 +00:00
Volker E
ed42e2fae2 HTMLCheckMatrix/CheckMatrixWidget: Adding th to thead
Improving semantics, which also reflects in screen readers.

Change-Id: I552a61a6e1892ebed86d9434366bd932f6f7a602
2018-11-16 15:27:19 -08:00
Thalia
a61d51af9e TitlesMultiSelectWidget: pass through 'input' config
Also set 'autocomplete' to false in the 'input' config
in Special:Block.

Bug: T208551
Change-Id: I0376e4ce809aeb48496530cdd5d39ac9142c28bd
2018-11-13 19:29:04 +00:00
Thalia
8fec7ed09a TitlesMultiselectWidget: rename 'limit' config to 'tagLimit'
To avoid conflicting with TitleWidget config.

Bug: T209057
Change-Id: Ia0dbc49f38a116202eb2658b7556fb7f0627f1bb
2018-11-13 19:29:04 +00:00
Thalia
61a6a0445b TitlesMultiselectWidget: pass through additional configs
Pass through 'limit' and 'showMissing' configs.

Also set 'showMissing' to false for partial blocks.

Bug: T208626
Bug: T208627
Change-Id: Ifa75e2d390bf349226ad69d68adcdcaf742ab560
2018-11-13 19:28:54 +00:00
C. Scott Ananian
d8e612ffaa Replace deprecated call to OutputPage::parse() in HTMLForm
Use OutputPage::parseAsInterface() to tidy the output and make the
selection of user interface language explicit.

Follow-up to Ifeb1ca6eb8b5c743421b8f9e329f1e3658050e47.

Bug: T198214
Change-Id: Ia4b63715380d97ccb3133bf39a260834c20b4f5a
2018-11-01 17:26:10 -04:00
jenkins-bot
ecee5cd7c7 Merge "Use PHP 7 '??' operator instead of if-then-else" 2018-10-24 21:58:04 +00:00
jenkins-bot
13dba84b6f Merge "Fix PHPDoc type for instance variables and methods" 2018-10-24 21:17:02 +00:00
jenkins-bot
e044600d9d Merge "HTMLForm: Remove parameters 'notice', 'notice-messages', 'notice-message'" 2018-10-24 17:14:34 +00:00
Moriel Schottlender
07a5c71646 TitlesMultiselectWidget: Add a widget that allows selection of multiple titles
Add the widget in both PHP and JS for OOUI, and into HTMLForm
definitions.

In JS, the widget uses the engine from mw.widgets.TitleWidget
with the async support from OO.ui.mixin.RequestManager.

The PHP version provides a textarea, like UsersMultiselectWidget.php
which is then infused if JS is available.

Also, add highlightSearchQuery option for TitleWidget to allow for
not highlighting the partial search query the user typed in, if the
UI requires it. This option (highlighting partial result) is already
optional in the TitleOptionWidget, so this config exposes that
optionality in the TitleWidget widget for its menu children.

Notes:

HTMLTitlesMultiselectField is a duplication of HTMLUsersMultiselectField
except for:
- The configuration variable changed to 'titles' (from 'users')
- OOUI modules were adjusted for the TitlesMultiselectWidget
- The PHP version instantiates a MediaWiki\Widget\TitlesMultiselectWidget

TitlesMultiselectWidget is a duplication of UsersMultiselectWidget
except for:
- $usersArray was renamed to $titlesArray
- getJavascriptClassName returns the correct js class for
  mw.widgets.TitlesMultiselectWidget for infusion.

Bug: T197109
Depends-On: I675316dddf272fd0d6172ecad3882160752bf780
Change-Id: Ie96947a35f70b76731e16ae5b85de815dfa4a8ce
2018-10-24 00:46:48 +00:00
Bartosz Dziewoński
54d9b373cd HTMLForm: Remove parameters 'notice', 'notice-messages', 'notice-message'
Bug: T197179
Change-Id: I911cabc1e1e1c2abb8e91a55c05eaa1c76134087
2018-10-22 12:19:58 -07:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
Alangi Derick
b4ecf374fe Fix PHPDoc type for instance variables and methods
Should be "string" not "String" and "array" not "Array" in
@param, @return and @var use cases. Also, minor typo fixes.

Change-Id: I9d5ebc5b741c6560907b95f7c0c4039da2861f4a
2018-10-21 13:00:25 +01:00
jenkins-bot
3d98b80a39 Merge "Add OOUI for HTMLFormFieldCloner" 2018-10-12 22:30:59 +00:00
Bartosz Dziewoński
c9b599abab HTMLInfoField: Undo breaking change, deprecate instead, add release notes
Follow-up to e6eb87ae20.

Bug: T203202
Bug: T205956
Change-Id: I2d19d376d218c59e4ea36e8635e883afac2adea6
2018-10-11 02:06:48 +02:00
mainframe98
8b48c99889 Add OOUI for HTMLFormFieldCloner
The JavaScript for the cloner fields has been updated to function
when using OOUI Cloners.

The buttons are packed quite tight together, but there does not
seem to be any CSS that enforced the spacing that I could find.

Bug: T171666
Change-Id: Iba6eed9d6cee922d56855bbe2e836956bfd90f42
2018-10-02 11:50:10 +02:00
jenkins-bot
8df18bbd13 Merge "HTMLInfoField: Support 'rawrow' in OOUI mode" 2018-09-30 18:18:26 +00:00
jenkins-bot
1dee28cb5f Merge "Simplify HTMLTitleTextField::validate" 2018-09-26 13:19:49 +00:00
Umherirrender
e75de52391 Simplify HTMLTitleTextField::validate
Title::makeName already provide a way to build a title string with
namespace text

Change-Id: I21518ca9d7c6101fc866f8d667a88cc7bdf5ae7c
2018-09-24 20:46:22 +02:00
jenkins-bot
9464d13770 Merge "HTMLForm: Drop this never-used backwards-compatibility" 2018-09-13 12:27:43 +00:00
Bartosz Dziewoński
938e9402a7 HTMLTextField: Pass extra parameters in OOUI mode
Some additional parameters that are passed through as attributes in
HTML mode were not being passed through as config options in OOUI mode:
* 'min'
* 'max'
* 'step'
* 'title'

Some have no equivalent in OOUI:
* 'pattern'
* 'list'
* 'multiple'

Also note that we support some OOUI config options that have no
equivalent in HTML:
* 'autosize'
* 'flags'
* 'indicator'

I originally noticed the problem with the 'min' and 'max' params,
which are clearly missing in OOUI preferences for RC and watchlist.
I don't know if anything anywhere actually uses the other ones.

Bug: T181844
Change-Id: I2d22ef3b08b7f0b4283b644d80bd74906177d089
2018-09-12 22:15:48 +02:00
James D. Forrester
6c6efe54ec HTMLForm: Drop this never-used backwards-compatibility
Change-Id: I6864d3a1207de44d465491baad87cb9c00714255
2018-09-12 13:14:18 -07:00
mainframe98
4d7b6e77bd Use NumberInputWidget in HTMLFloatField
The PHP variant of this widget was introduced in 0.27.0.
Using NumberInputWidget has the advantage that HTMLFloatField and
HTMLIntField can now be infused as a JavaScript NumberInputWidget.

Bug: T203656
Change-Id: I5d6a913de38d12a21c9bfb1ce9790574d98a5a1b
2018-09-12 08:12:42 +00:00
jenkins-bot
02a115bc19 Merge "HTMLCheckMatrix: Treat row/column labels as HTML in OOUI mode" 2018-09-04 19:37:37 +00:00
jenkins-bot
4c52667df1 Merge "EditWatchlistNormalHTMLForm: Fix double-escaping of section legends" 2018-09-03 21:58:31 +00:00
Bartosz Dziewoński
45ced4dfef EditWatchlistNormalHTMLForm: Fix double-escaping of section legends
Parent getLegend() returns a plain string, and this method should
do the same.

Form section legends are escaped by the wrapFieldSetSection() method.

Change-Id: I2059b9182fba7362f3d6226252bdc3e032a06c57
2018-09-03 22:09:13 +02:00
Bartosz Dziewoński
1ddc66a395 HTMLCheckMatrix: Treat row/column labels as HTML in OOUI mode
We were incorrectly escaping them. They are supposed to be already
correctly escaped HTML.

Also improve documentation and really allow 'tooltips' to be optional.

Bug: T203325
Change-Id: I1f92479bf1989e1529b18b8b206b61db1257eb87
2018-09-03 21:37:31 +02:00
Bartosz Dziewoński
65b11b8fee Use PHP 7 '??' operator instead of '?:' (round 2)
A few issues have snuck in since I33b421c8cb11cdd4ce896488c9ff5313f03a38cf.

Change-Id: Ib75470a7a3c19e2d48f498b396eee6ed733690e4
2018-09-03 20:48:10 +02:00
Bartosz Dziewoński
e6eb87ae20 HTMLInfoField: Support 'rawrow' in OOUI mode
To be compatible with OOUIHTMLForm, 'default' must be a FieldLayout
(or a subclass of FieldLayout) when using 'rawrow'.

(Technically, it works when it's a string, but that's only by chance.)

Bug: T203202
Change-Id: I571c619c32a806016b649562f5efe52ad45ef036
2018-09-03 18:41:55 +02:00
Brian Wolff
2db0dc2438 Add taint annotation to HtmlForm::getHTML()
This is to help AbuseFilter pass phan-taint-check.

Change-Id: I73a6a626337037f6b0cee04b0afb5a59907d3be6
2018-08-31 19:32:46 +00:00
jenkins-bot
fede766fe9 Merge "Fix some warnings from phan-taint-check" 2018-08-30 02:54:03 +00:00
Bartosz Dziewoński
76e7016993 HTMLForm: Deprecate parameters 'notice', 'notice-messages', 'notice-message'
Bug: T197179
Change-Id: I603436e0720fdc0f08f35f3c0630b79865a9c82a
2018-08-29 22:02:52 +02:00
jenkins-bot
33afb7440a Merge "Expand documentation about options in HTMLForm" 2018-08-25 06:51:43 +00:00
jenkins-bot
b79bc0a274 Merge "OOUIfy CheckMatrix in PHP and JS" 2018-08-22 20:09:12 +00:00
Moriel Schottlender
5a430cdc1c OOUIfy CheckMatrix in PHP and JS
This is to make sure that the design is similar, but also so
that the widget can be read in JS where needed and that we
can toggle the disabled state on/off through the whole widget,
that is made from a series of checkbox widgets.

Bug: T199946
Change-Id: I9943b0aa1746fdfb60c7d4c88d6d4d7ac0589a2c
2018-08-22 21:31:27 +02:00
Ed Sanders
e5911a826c Pass through 'helpInline' to OOUI FieldLayout and make true by default
This change is meant to improve the layout of Special:Preferences in
particular, but it will affect any OOUI form using help messages. It
should be a harmless or beneficial change for most of them.

Previous behavior can be restored by passing `'help-inline' => false`
to the HTMLForm factory after 'help-message'/'help-messages'/'help'.

For example:

* Special:Preferences?ooui=1#mw-prefsection-watchlist
  * Before: https://phabricator.wikimedia.org/F25025213
  * After:  https://phabricator.wikimedia.org/F25025181

* Special:ChangeEmail
  * Before: https://phabricator.wikimedia.org/F25073327
  * After:  https://phabricator.wikimedia.org/F25073328

* Special:BotPasswords/foo
  * Before: https://phabricator.wikimedia.org/F25073324
  * After:  https://phabricator.wikimedia.org/F25073326

Bug: T181854
Change-Id: Ica67fe4081dfaa8eb9e8f56fdb93530750e47012
2018-08-17 22:34:33 +02:00
Fomafix
0a0d5cb7f7 Fix typos
Bug: T201491
Change-Id: I25a27d11faabe2f5fa02950c7a4fb58b13fb3662
2018-08-14 09:52:19 +00:00
Brian Wolff
f631c16e84 Fix some warnings from phan-taint-check
Change-Id: I58af7bc21f4c6b77dbda689faa904b53705fe576
2018-08-13 23:00:06 +00:00
Umherirrender
7b01567b00 Expand documentation about options in HTMLForm
Change-Id: Ia170f07f994680dca105981a14ad5a0d98b57a26
2018-08-13 09:16:11 +02:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
mainframe98
71ea2670a9 Fix the GlobalTitleFail debug notice for HTMLButtonFields
These occur when buttonlabel-message is set. HTMLButtonField
parses the message in its constructor, but at that point the
context (provided by the form field by HTMLForm::$mParent) is
not yet available. The constructor of HTMLForm assigns $mParent,
but that constructor is only called after the button label
message is parsed.

Bug: T201497
Change-Id: I021c9ecf3bc934f2cf55ec100e799c1c12e7bc01
2018-08-08 11:45:04 +01:00
Prateek Saxena
820a18762f SelectWithInput: Add 'disabled' property on main widget
…also HTMLSelectAndOtherField and HTMLSelectOrOtherField now
pass the 'disabled' field when creating the input widget.

The OOUI versions of these HTMLFormFields would get enabled
right after infusion even they were disabled in PHP. This
makes sure that they remain disabled.

Change-Id: Iddd8ad81731dba7bdcb599d6fe104cb259b11733
2018-07-25 12:02:50 +05:30
jenkins-bot
b85e01f60b Merge "HTMLMultiSelectField: Improve compat with GET forms with no wpFormIdentifier" 2018-07-23 02:55:53 +00:00
Bartosz Dziewoński
098fd0dcb3 HTMLMultiSelectField: Improve compat with GET forms with no wpFormIdentifier
Now it behaves more like HTMLCheckField: if there is clearly a value
submitted, it will load it.

Setting wpFormIdentifier is still needed for forms with default-on
checkboxes (without form identifier, it is impossible to distinguish a
page view without form submission, and form submission with default-on
checkbox unchecked).

In particular, this fixes the 'Show additional logs' checkboxes on
Special:Log: they no longer get unchecked after form submission.

Change-Id: Ief74a7e424b37ccd44759133b3cb8665275314a6
2018-07-18 20:10:04 +02:00
Prateek Saxena
500f7a5bad HTMLTitleTextField, HTMLUserTextField: Check for null before using the value
Otherwise HTMLTitleTextField sends null to Title::newFromTextThrow(),
which causes an exception when trying to look it up in a cache.

Similar issue is present in HTMLUserTextField, although that one
hasn't caused problems in practice yet.

Follows-up on I93ad51ffe7bee597d2d127f4c5d6b2929ffc8f7e and
I0de4194a37b6ef260d35feb1e6730985775d5351.

Bug: T199763
Change-Id: I29ecd94cdf9e3064e6e9e7f4e65a50f267b5282d
2018-07-18 00:42:52 +02:00
jenkins-bot
ef97002179 Merge "Simplify PHP by using ?? and ?:" 2018-07-11 09:09:18 +00:00
Fomafix
6866cfec37 Simplify PHP by using ?? and ?:
Also remove not necessary surrounding parentheses.

Change-Id: I0eb5c9c1bdfb09a800258379cdcefb5fd4d3d21c
2018-07-10 20:03:17 +00:00
jenkins-bot
ead3a32d9f Merge "Add a method to HTMLForm that allows the preText to be accessed externally." 2018-07-09 18:35:24 +00:00
Volker E
f4888e1442 Replace 'capsule' with appropriate 'tag'
UsersMultiselectWidget class extends OOUI's MenuTagMultiselectWidget,
not CapsuleMultiselectWidget any more.

Change-Id: Iea7450a371720bed392dfedb1032bc8c63c89fc4
2018-07-09 19:44:09 +02:00
David Barratt
d609da624b
Add a method to HTMLForm that allows the preText to be accessed externally.
Currently there is no way to access the preText outside of an HTMLForm. Adding
a getPreText method to HTMLForm so the preText is accessible.

Bug: T199115
Change-Id: I937028e7025b4a7b5d333e9bf5a25920f6a88316
2018-07-09 10:42:19 -04:00