Commit graph

84 commits

Author SHA1 Message Date
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
David Barratt
b39ce8f791 Allow users to prevent new users from sending them email.
Users now have the option to prevent Newbie users from sending
them emails.

Bug: T138165
Change-Id: I5d5332e50971fbcd1fa630d6bd03bdf757a9d1f1
2017-12-11 22:04:18 -05:00
Brian Wolff
462bce95a9 placeholder-message for html form should be ->text() not ->parse()
placeholder is an html attribute, it does not support arbitrary
html, so ->text() is most appropriate, not full parse.

Follow up d3cd609e

Change-Id: Ia2aa5a001e19ee90e99936ef4f0dc879f182999f
2017-12-07 01:42:24 +00:00
Bartosz Dziewoński
f752323054 HTMLMultiSelectField: Allow formatting in section headings in OOUI mode
Follow-up to 5a113417e5.
It is allowed in non-OOUI modes.

Bug: T181698
Change-Id: Ib2ebcd1a92f1b02a528787fe3fd1f5452b9808c4
2017-11-30 17:38:30 +01:00
jenkins-bot
2fbbf65951 Merge "HTMLMultiSelectField: Fix OOUI\CheckboxMultiselectInputWidget to be infusable again" 2017-11-16 17:22:40 +00:00
Bartosz Dziewoński
f2a83fe4ac HTMLRadioField: Do not automatically infuse our RadioSelectInputWidgets
This is really a workaround for an issue in a completely different place:
JS RadioSelectInputWidget internally uses `<input type="hidden">`
rather than real radio buttons, which does not work correctly with the
code in mediawiki.special.preferences.confirmClose.js. Ideally we would
change RadioSelectInputWidget to not do such weird things.

However, I think this is actually a good thing to do in general.
From the user's perspective, PHP RadioSelectInputWidget and JS
RadioSelectInputWidget look and behave the same, so there's no reason
to infuse and rebuild them.

This behavior was implemented in f50cee1375
in which unfortunately I did not document the reason for it. For other
fields it makes obvious sense (the JS widgets have improvements like
autocompletion, or at least look "pretty"), but I have no idea why
I did it for this one.

Bug: T180643
Change-Id: I53e50f8cda39466b2396b374e642c154487888bb
2017-11-16 17:33:03 +01:00
Bartosz Dziewoński
a81db83d79 HTMLMultiSelectField: Fix OOUI\CheckboxMultiselectInputWidget to be infusable again
Regression from 5a113417e5.

Bug: T180677
Change-Id: Id1b0ebe9d9a56a76d73deb2b4d17213ae5e45a04
2017-11-16 11:51:58 +01:00
Ori Livneh
a603ae73a7 Fix letter-case of several namespace and class names
'Mediawiki\Widget\SelectWithInputWidget' is the only one that shows up
in the logs, but I tidied up a few others I came across.

Change-Id: I700dec858007a8013e6d7b9e37ddf518f223d8b7
2017-10-14 21:43:05 -04:00
James D. Forrester
fb4e63ba3f Update OOjs UI to v0.23.5
Release notes:
 https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/History.md;v0.23.5

Also, replace uses of `OOUI\TextInputWidget( [ 'multiline' => true ] )`
with `OOUI\MultilineTextInputWidget()` to avoid deprecation warnings
(which cause unit tests to fail).

Depends-on: I990b14982ffb72fe981040d02c7023d13f721aaa
Change-Id: If8312c60e1547a6177f5491011badb6576f54b21
2017-10-12 14:45:39 -07:00
jenkins-bot
04a8781b3e Merge "HTMLMultiSelectField: Support sections in OOUI mode" 2017-10-05 23:40:07 +00:00
Florian
b73c0c4d3f Enable IP ranges in HTMLUserTextField
Like an existing user and a single IP, allow to use an IP range, too.

Bug: T107039
Change-Id: I9137f71f6119c68d787f508a3f57b476404315d8
2017-09-29 19:55:19 +02:00
Bartosz Dziewoński
5a113417e5 HTMLMultiSelectField: Support sections in OOUI mode
The resulting HTML makes very little sense semantically, but no
worries, because so does the existing one for non-OOUI forms.

Change-Id: I99bf6341c58869f6322b9d9c780d9c66739d00b6
2017-09-28 14:17:05 +02:00
Bartosz Dziewoński
e8a0b0552d HTMLSelectAndOtherField/HTMLSelectOrOtherField: Change how ID is handled in OOUI mode
Set the ID on the main widget (mw.widgets.SelectWithInputWidget), so
that it can be infused by ID.

The dropdown/textbox by themselves can't be infused individually,
therefore IDs on them are pretty useless; remove those where they're
not necessary.

Follow-up to 8bd6605736.

Change-Id: If54dd48f1000e3e0f5a978428a5b622797b4f765
2017-09-25 20:50:34 +02:00
Umherirrender
ffaf38ce98 Do not depend on PHP_EOL in HTMLRestrictionsField
HTMLRestrictionsFieldTest::provideValidate only provide test cases with
\n, which fails on windows machine.
I see no reason to use the system depending constant here

Change-Id: I7caf2c4d06c84cac69e20e03d00a93bcd8e7d405
2017-09-20 22:01:34 +02:00
Sam Wilson
feb5be31fd Add classes to HTMLCheckMatrix items to identify forced ones
Some items in an HTMLCheckMatrix form field can be forced to be
on or off, in which case they're disabled. This adds three new
class names, so that (for example) Javascript can identify these
checkboxes. There are not currently any classes assigned to them.

Bug: T172585
Change-Id: I984020ce2437effb3ff5f186470105fd80d4a00f
2017-09-19 15:46:25 +08:00
jenkins-bot
237d3271fd Merge "HTMLForm: Implement OOUI version of HTMLTagFilter" 2017-09-10 12:17:03 +00:00
Umherirrender
3f1a52805e Use short type bool/int in param documentation
Enable the phpcs sniffs for this and used phpcbf

Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
2017-08-20 13:20:59 +02:00
Max Semenik
fd6e9ef2d4 Human-readable section ID support
It adds the ability to replace the current section ID escaping
schema (.C0.DE) with a HTML5-compliant escaping schema that is
displayed as Unicode in many modern browsers.

See the linked bug for discussion of various options that were
considered before the implementation. A few remarks:
* Because Sanitizer::escapeId() is used in a bunch of places without
  escaping, I'm deprecating it without altering its behavior.
* The bug described in comments for Parser::guessLegacySectionNameFromWikiText()
  is still there in some Edge versions that display mojibake.

Bug: T152540
Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
2017-08-01 20:32:20 -07:00
Bartosz Dziewoński
8c1a1a62a1 Avoid duplicate accesskey hints on OOUI widgets
Values returned by `Linker::tooltipAndAccesskeyAttribs()` and
`Linker::titleAttrib( ..., 'withaccess' )` include an accesskey
hint in the title text. This is unnecessary when used for OOjs UI
widgets, since after the changes from T168408 they display an
accesskey hint automatically.

Also fixed some other accesskey bugs in HTMLForm which probably
no one ever ran into.

Bug: T168408
Change-Id: I63285b5bce3341875a6d82eba059623bf105ca62
2017-08-01 20:59:13 +00:00
Roan Kattouw
4078bb6b52 HTMLUsersMultiSelectField: Don't use content language for placeholder message
No idea why this was using content language to begin with, but it seems
like it should clearly use the user language instead.

Bug: T171817
Change-Id: I1763ffd8ee037dbb5dd94c410cb6a82e0f6b27e9
2017-07-27 09:38:57 -07:00
jenkins-bot
7471e1db1b Merge "HTMLSelectAndOtherField/HTMLSelectOrOtherField: Add OOUI implementation" 2017-07-18 16:26:11 +00:00
Roan Kattouw
7c0a58393b HTMLUsersMultiselectField: Handle empty value properly
If the string value is '' (empty string), the array
value should be [] (empty array), not [''] (array of one element
which is an empty string).

Bug: T169384
Change-Id: I558f3890af05efb6eaa18403467c0a05f44af12a
2017-07-11 11:29:17 -07:00
jenkins-bot
5049af1048 Merge "Fix \n handling for HTMLUsersMultiselectField" 2017-06-30 02:21:13 +00:00
Matthew Flaschen
a3e2d832d7 Fix \n handling for HTMLUsersMultiselectField
Bug: T166836
Change-Id: I51b772946f1e50a21fb86cab969defb4647b820b
2017-06-29 19:02:46 -07:00
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
Prateek Saxena
8bd6605736 HTMLSelectAndOtherField/HTMLSelectOrOtherField: Add OOUI implementation
Bug: T106999
Change-Id: I0f437ed8a8808f8090bf466fd939345d74d57c34
2017-06-15 08:52:08 +05:30
Bartosz Dziewoński
cf6e108a5c HTMLUsersMultiselectField: Make auto-infusable when used inside a legacy HTMLForm
Change-Id: I23b3a86f06a10b066e6671e398da37c62e3e61b1
2017-05-20 16:13:17 +02:00
Timo Tijhof
3a2a707546 Clean up remaining get_class() uses
* get_class()        -> __CLASS__ (same as self::class)
* get_called_class() -> static::class
* get_class($this)   -> static::class

Change-Id: I1888a1897ecf4548a2e5a67a942e5c080dd7e3d3
2017-03-07 22:03:47 +00:00
Huji Lee
c96166173e HTMLMultiSelect parameter to specify which options are disabled
Depends on I32fa20e4adb23960d9db6bf6023f79bf128fb600

Bug: T153751
Change-Id: I3bcf6720c960e0be962e0f3f37a22ec8778db1d1
2017-03-07 22:16:37 +01:00
jenkins-bot
fb52b78920 Merge "UsersMultiselect widget and form field." 2017-02-01 14:37:50 +00:00
Phantom42
c70f464c07 UsersMultiselect widget and form field.
New widget and html form field, which allows selecting multiple
users using convenient single-line input (CapsuleMultiselectWidget)

Bug: T131492
Change-Id: I7b6ffe7fb47e0a7083e2a956156ab0f142444398
2017-02-01 00:35:33 +02:00
Bartosz Dziewoński
72aad7fffd HTMLTextField: Set the 'dir' attribute in OOUI mode
Bug: T153636
Change-Id: I7ddf6a358f8150ef252d8d8e76661fe1eb93a790
2017-01-19 16:19:27 +01:00
Florian Schmidt
92b170efc3 HTMLForm: Implement OOUI version of HTMLTagFilter
Bug: T117739
Change-Id: Ia9990d1089773f61721cce731bb6cb767a174467
2017-01-11 21:29:01 +01:00
Bartosz Dziewoński
205231d7da HTMLDateTimeField: Remove hacks for HTML5 form validation attributes
No longer needed after I08244addcf9b6eb96137895f28e7b750914fef5c.
Also remove datetime.js from mediawiki.htmlform module.

Change-Id: Ic2410c689de3f70f573fa1c71456e6d3f334f80b
2017-01-10 22:53:33 +00:00
Bartosz Dziewoński
a83188d0ab HTMLFormFieldCloner: Set 'formnovalidate' on add/remove field buttons
Otherwise, after we allow HTML5 form validation attributes, these
buttons wouldn't work for non-JS users (unless the whole form was
otherwise valid).

Change-Id: Ia9c16849774c186b991280ea60fc5608ddd4cf42
2016-12-18 12:58:26 +00:00
jenkins-bot
f9e21f91e4 Merge "mw.htmlform: Fields hidden with 'hide-if' should be disabled" 2016-12-18 12:56:11 +00:00