Commit graph

119 commits

Author SHA1 Message Date
jenkins-bot
c1436805cd Merge "Introduce multiselect widgets for namespaces" 2019-01-23 17:02:41 +00:00
Thalia
ccbe9f3590 Introduce multiselect widgets for namespaces
Bug: T204986
Change-Id: Ie3916e2322d8b1a7effe9ba4604b596b568004e6
2019-01-22 12:48:42 +00:00
SamanthaNguyen
870831d40c htmlform: Move HTMLSelectLanguageField into includes/htmlform/fields
This was originally directly under includes/htmlform. This is
a specific type of field, so it should go here instead.

Follows-up d0c31ac988.

Change-Id: Iac196068ce2cbca063948bc78d21913482717d9a
2019-01-22 04:56:44 +00:00
Thalia
1d442c19cf Fix TitlesMultiselectWidget documentation
Change-Id: I4b6bad233b4a4dfd840385f26a10bd190f6cb6b9
2018-12-10 18:28:14 +00:00
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
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
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
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
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
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
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
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
Fomafix
f02eed24ac Allow overloading of getLabel() with return ' '
This is a follow-up to 125cbd8c01.

Bug: T198338
Change-Id: I21626326dde368d70fcc33052e43ff90db5ea9c0
2018-06-28 11:25:39 +02:00
Umherirrender
bc1f596877 Declare HTMLSelectNamespace::mAllValue
It is protected, because some extension extends this class

Change-Id: I576e9e7e843844433655b11b8847c9e3060ba8e9
2018-06-26 16:07:10 +02:00
Fomafix
125cbd8c01 Use \u{00A0} instead of   or  
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of
the HTML/XML entities   or   or  .

With the UTF-8 character the generated HTML is shorter and better to read.

Also change the special value for the label in HTMLForm from   to
U+00A0 but also support   for backward compability.

Bug: T154300
Change-Id: I882599ac1120789bb4e524c4394870680caca4f4
2018-06-24 01:20:13 +00:00
Fomafix
0f1858321c Use PHP 7 '??' operator instead of if-then-else
Change-Id: I790b86e2e9e3e41386144637659516a4bfca1cfe
2018-06-12 23:14:18 +02:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Bartosz Dziewoński
f88a5a1815 HTMLTitleTextField: Allow this field to not be required
Previously we would always run the validation, and it would fail when
the field was empty, since empty string is not a valid title.

Respect the 'required' option (defined by HTMLFormField) and make it
default to true for compatibility with existing forms that might rely
on this.

Also add a TODO comment about a confusing special case in validation
code. I don't want to dig into that.

Change-Id: I93ad51ffe7bee597d2d127f4c5d6b2929ffc8f7e
2018-05-07 20:57:51 +02:00
Max Semenik
94e7349de4 Fix class/function case mismatches
Change-Id: I25632d4db5a451975cb7a678372d8675c28c0897
2018-05-05 22:16:04 +00:00
David Barratt
3481e3b2e0
Create Expiry Widget with Date Time Selector
Special:Block needs a date time selector for easier selection of expiry. To
accommodate this cleanly, a new Expiry Widget is created that handles this
logic.

Bug: T132220
Change-Id: I2853a2ca0ae6ccead3978f4bb50a77c2baa3a150
2018-04-19 20:24:08 -04:00
Bartosz Dziewoński
211d1650ac HTMLSizeFilterField: Add OOUI version
Bug: T183765
Change-Id: Ie86d1682f2e1b088300474e96fa7da975ad0ec9f
2018-03-01 21:30:17 +01:00
Brad Jorsch
ccc1c08089 Update more forms to limit comments by codepoints rather than bytes
This updates the deletion forms, Special:Block, Special:EditTags,
Special:MovePage, Special:RevisionDelete, Special:Undelete, and
Special:UserRights to limit by code point count rather than by byte (or,
in some cases, by UTF-16 code unit).

Bug: T185948
Change-Id: I20d11d7cc4f58902cbcb6dda70af533bce6dd170
2018-02-26 13:16:19 -05:00
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Ed Sanders
5f49c61c63 HTMLTextAreaField: Add 'useeditfont' param
Change-Id: I7c76e911b4d71842b49272186e880051eee8de2b
2018-01-03 22:08:53 +01:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
David Sn
cb401293c5 Fix tooltip accessibility for screen readers
By adding an additional aria-label attribute to the tooltip,
we can ensure that every tooltip will be accessible
for accessibility tools like screen readers.

Works with Echo extension, but I am not sure if there
are extensions who are using the original-title attribute.

Tested with ChromeVox on Chrome 62.0.3202.94.

Bug: T54711
Change-Id: I19500c4e8ccbdcb8288b9c2299a29b3f8a31639d
2017-12-16 15:43:30 +01:00