aboutsummaryrefslogtreecommitdiffstats
path: root/includes/htmlform/fields
Commit message (Collapse)AuthorAgeFilesLines
...
| * HTMLFormField: Codex CSS-only version of HTMLRadioFieldlwatson2024-03-191-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds a CSS-only version of Codex Radio via HTMLRadioField. Iterates through the list of options obtained from `getOptions()` and generates the HTML markup for each radio input, radio icon, and radio label. The three elements (input, icon, label) combined make a single Codex Radio. The Radios are appended to an empty `$html` string variable. The function returns the concatenated HTML markup. Bug: T359015 Change-Id: I73b2e95cff0bc50ba1bc70457d65e286592288ac
* | Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-1940-40/+40
|/ | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* HTMLForm: Use rows=10 instead of rows=25 for Codex multiselect fieldsRoan Kattouw2024-03-182-2/+6
| | | | | | | | | | | | | The Codex implementation of HTMLNamespacesMultiselectField and HTMLTitlesMultiselectField falls back to a simple `<textarea>`, which is also what the OOUI implementation does if JS is not available. However, OOUI sets rows=10, which results in a much more reasonably sized textarea then HTMLTextAreaField's default of rows=25. Pass rows=10 to HTMLTextAreaField, but allow the field params to override this. Change-Id: I1e9a1ab6b4a71fb247bfe7861a49bb6cfeb61f54
* HTMLFormField: Use Codex TextArea for multiselect fieldsAnne Tomasevich2024-03-143-0/+64
| | | | | | | | | | Add support for generating a Codex TextArea via HTMLTextAreaField, then add Codex handlers to HTMLNamespacesMultiselectField and HTMLTitlesMultiselectField, which fall back to a TextArea. Bug: T359015 Change-Id: I659241f56fae8aa60e25ad0c65b62e8465edad99
* HTMLFormField: Add Codex version of Select-related fieldsAnne Tomasevich2024-03-135-6/+158
| | | | | | | | | | | | | | | | | | This patch enables use of a Codex component for the following HTMLFormFields: - HTMLExpiryField - HTMLSelectAndOtherField - HTMLSelectField - HTMLSelectOrOtherField It also adds a new public static method to HTMLTextField that takes in attributes and returns the HTML for a Codex text input. Note that the Codex CSS-only Select does not yet support an error state, so this has not been implemented here. Bug: T359015 Change-Id: I6857813b9dbe09ae68d6cafdc87351d01626266a
* HTMLFormField: Refactor Button, Check, and Text handling of CodexAnne Tomasevich2024-03-133-29/+121
| | | | | | | | | | | | | | - Refactor the HTMLButtonField, HTMLCheckField, and HTMLTextField classes to include getInputCodex() methods, rather than checking if CodexHTMLForm is being used. - Add error classes if applicable. - For HTMLCheckField, ensure that tooltips are propagated to the wrapper div instead of the label, so a tooltip will display no matter which part of the component you're hovering over (including the space between the input and label text). Bug: T359013 Change-Id: I0ead69e2b6b33f48949a2dfe40140f2ef957bc06
* Rename dropdown-related methods to avoid random camel-caseBartosz Dziewoński2024-03-091-2/+2
| | | | | | | | | | | | | | | | It's a dropdown, not a drop down, therefore rename: * Html::listDropDownOptions → Html::listDropdownOptions * Xml::listDropDownOptions → Xml::listDropdownOptions * Html::listDropDownOptionsOoui → Html::listDropdownOptionsOoui * Xml::listDropDownOptionsOoui → Xml::listDropdownOptionsOoui * Xml::listDropDown → Xml::listDropdown In PHP, method names are case-insensitive, therefore we can do this without a breaking change or deprecation. This also matches the naming convention in OOUI. Change-Id: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
* Add 'maxlength' and 'minlength' support to HTMLTextAreaFieldAgent Isai2024-02-151-0/+4
| | | | | Bug: T347541 Change-Id: If2d5868c23339ecc06fc76a66bc77b41cd10607d
* Namespace HTMLForm and friendsJames D. Forrester2024-02-1440-50/+332
| | | | | Bug: T353458 Change-Id: I09e66c3223018ec47e0549ee7f6a590b676f4eef
* build: Upgrade mediawiki/mediawiki-phan-config from 0.13.0 to 0.14.0 manuallyJames D. Forrester2024-02-102-3/+2
| | | | | | | | | | | * Switch out raw Exceptions, mostly for InvalidArgumentExceptions. * Fake exceptions triggered to give Monolog a backtrace are for some reason "traditionally" RuntimeExceptions, instead, so we continue to use that pattern in remaining locations. * Just entirely give up on PostgresResultWrapper's resource vs. object mess. * Drop now-unneeded false positive hits. Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
* Namespace includes/contextJames D. Forrester2024-02-082-0/+2
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Merge "Remove uses of $wgUseMediaWikiUIEverywhere"jenkins-bot2024-02-054-29/+4
|\
| * Remove uses of $wgUseMediaWikiUIEverywhereBartosz Dziewoński2024-02-044-29/+4
| | | | | | | | | | | | | | | | | | Removing the config variable in a separate change: Ib9966bc6a4a94f771cb99a5aa52fb6a1dc826ca5 (just in case something depends on its existence). Bug: T182050 Change-Id: Ic3e038df16fc540ec7f6bcb9a54d73f8d596d305
* | Html: Copy listDropDownOptions() and listDropDownOptionsOoui() from Xml and ↵James D. Forrester2024-02-031-2/+2
|/ | | | | | | migrate users Bug: T356544 Change-Id: Ibcc13c92a48b3fd2a33914418dfbefb0dd890c82
* Merge "Replace a few array_key_exists with the ??= syntax"jenkins-bot2024-01-161-3/+1
|\
| * Replace a few array_key_exists with the ??= syntaxthiemowmde2024-01-081-3/+1
| | | | | | | | | | | | | | | | Or just remove it. It's not needed when the structure is already an array. PHP will happily initialize multi-dimentional arrays when needed. Change-Id: I93845e8d6f870d147bd55cfe3827bc94b375d0ba
* | htmlform: Improve type safety related to HTMLFormFieldClonerthiemowmde2024-01-131-4/+6
|/ | | | | | | | | | | | The main benefit is that IDEs, static analyzers and such are now able to understand that this refers to code from the HTMLFormFieldCloner class. This was completely hidden before. Also fix a mistake in the documentation for getNearestField. This was accidentally copying the getNearestFieldValue documentation, which does return mixed. Change-Id: Ie4204bc967013825d9d73d30f264b07ff0c9e846
* Merge "htmlform: Correct validation for file input field"jenkins-bot2023-12-181-1/+8
|\
| * htmlform: Correct validation for file input fieldAmmarpad2023-12-181-1/+8
| | | | | | | | | | Bug: T327007 Change-Id: Ibe8a4b2d77b530b9612285e422cbb3eca14d532e
* | Allow setting page restrictions on BotPassword grantsSiddharth VP2023-12-051-3/+26
|/ | | | | | | | | | | | | | | Helps bot operators adhere to the principle of least privileges. Grants can now be restricted to allow editing (and other write operations) for upto 25 listed pages. The page IDs are persisted within the bp_restrictions field of bot_passwords table, and in the session metadata. This restriction is checked only as part of expensive checks in PermissionManager, since they are not applicable for UI actions. Bug: T349957 Change-Id: I3d228eb97664d040a160c5b742d9176fdfae9a43
* Refactor HTMLRestrictionsField to allow more restrictions to be addedSiddharth VP2023-11-231-42/+30
| | | | | | | | | | | Earlier, loadDataFromRequest() returned MWRestrictions object only in case of valid input, and the original string if invalid. Now, an MWRestrictions object is returned in all cases, on which we now have a validity field. This also de-duplicates the check to find the invalid IP address(es). Bug: T349957 Change-Id: Iadb762b572cf0e7d2b92dbc4912804a3ddb48e74
* htmlform: Support HTML tooltips in checkmatrixGergő Tisza2023-11-061-0/+5
| | | | | | Bug: T290790 Bug: T254222 Change-Id: I69e8217c408acca6bd7f19e7e274b255336dccd2
* Unmark HTMLRestrictionsField as stable to extendSiddharth VP2023-11-041-1/+0
| | | | | | | | | | This is a composite field meant for a specific purpose, rather than a fundamental component. No sub-classes were found in Code Search. Bug: T349957 Change-Id: Idfb526a341b95322b698a5992b72f5ee8aabf497
* HTMLSizeFilterField: Keep min/max selection for empty inputFunc2023-09-241-10/+9
| | | | | | | | Using a flag depends on the *-mode query param, so won't care about the default value of empty input being 0, empty string, or null anymore. Bug: T347229 Change-Id: I389adfdf941a8cfd96a68b66120a209b5f38fbbe
* Namespace Sanitizer under \MediaWiki\ParserJames D. Forrester2023-09-212-0/+2
| | | | | Bug: T166010 Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
* Namespace remaining User-related classes under \MediaWiki\UserJames D. Forrester2023-09-201-0/+1
| | | | | Bug: T166010 Change-Id: Ibda1e8be0f23c6262a32b607f8260cad36f188fc
* Namespace remaining Title-related classes under \MediaWiki\TitleJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: Ia2e5a7367cc8cdbd8a7b845ae2fd5d776ff22891
* Reorg: Move WebRequest to includes\RequestAmir Sarabadani2023-09-117-0/+8
| | | | | | | This has been approved as part of RFC T166010 Bug: T321882 Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
* Merge "htmlform: Do not wrap HTMLTextField in cdx-text-input for non-codex"jenkins-bot2023-09-051-3/+4
|\
| * htmlform: Do not wrap HTMLTextField in cdx-text-input for non-codexUmherirrender2023-08-161-3/+4
| | | | | | | | | | Follow-Up: I834cc0e07fc1e705753df6866a5eeda2ac77fb8e Change-Id: I69e022c8c64e35aa88e93ea02b66380f481bf070
* | SpecialContributions: Allow checking edits by imported actorsFunc2023-08-291-0/+6
| | | | | | | | | | | | | | Introduced a new param for HTMLUserTextField allowing external users. Bug: T344978 Change-Id: I586869f024b928c5d74a8514ba876ab22d664c95
* | Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* | Condense and simplify some conditionals/returnsReedy2023-08-221-3/+4
| | | | | | | | Change-Id: Ibfc8ad6375555cfafb649dc96c91b5415a8ea0ff
* | Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
|/ | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* Special:ListFiles: UX improvementsHannah Okwelum2023-08-131-0/+3
| | | | | | | | See T194067 for what this patch is supposed to fix, additionally, We introduced a new method to escape the result of `getLimitSelectList()` in ImageListPager because phan was shouting. In HTMLRadioField.php on line 67, I converted the label value to a string because HtmlSnippet accepts only a string Bug: T194067 Change-Id: I9cc81df0d3225dce4dca50361be9e2561e50e260
* Avoid DB access in non-database testsDaimona Eaytoy2023-08-062-4/+7
| | | | | | | | Mock the needed dependencies to avoid database access when possible, and add the test to the Database group otherwise. Bug: T155147 Change-Id: Ic5c39ab35ab4d993721713285180f072497a5a40
* Login page: Use Codex CSS componentsJon Robson2023-07-063-5/+33
| | | | | | | | | | | | | | Changes: * Use Codex markup instead of mediawiki ui markup * We limit what can be customized by the skin * Current rules for touch area and snapping of inputs is moved from Minerva into core so other skins benefit from the styling * A placeholder text is adding to the "real name" field. * Introduce CodexHTMLForm Bug: T182050 Change-Id: I834cc0e07fc1e705753df6866a5eeda2ac77fb8e
* Merge sequences of `if` that end doing the same thing anywaythiemowmde2023-06-161-4/+1
| | | | | | | | | Motivation: * Avoid code duplication. * Hopefully make it easier to read. * Also order stuff from cheap to expensive, if possible. Change-Id: I575e3f2027ce60a0d0885be5b9bd3e07bc035eee
* Replace some more usages of deprecated MWExceptionDaimona Eaytoy2023-06-091-4/+2
| | | | | Bug: T328220 Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
* htmlform: Always return string from HTMLCheckField::getLabelUmherirrender2023-06-021-1/+1
| | | | | | | | | | | | | | | Function is documented to return string and parent class also has this check 1) SpecialPageFatalTest::testSpecialPageDoesNotFatal trim(): Passing null to parameter #1 ($string) of type string is deprecated /workspace/src/includes/htmlform/HTMLForm.php:1971 /workspace/src/includes/htmlform/HTMLForm.php:1535 /workspace/src/includes/htmlform/OOUIHTMLForm.php:286 Change-Id: I40d0ca4af001ab8ee6e182ab49988c9507db6eac
* Implement HTMLToggleSwitchField for mobile layout of preferencesFunc2023-05-181-0/+49
| | | | | | | | | | | This is the more native way of doing things, which avoids syncing different states between the toggle and the hidden widget. The DOM structure is also better and don't confuse screen readers. Bug: T333496 Bug: T334705 Bug: T336107 Change-Id: I47de69459b96f172153065094eb4113584bb435a
* Drop mw-ui-radio markupJon Robson2023-05-121-6/+0
| | | | | | | | | The HTMLRadioField is seldom used, and never inside an HTMLVForm and never without OOUI so this code is serving no purpose. Bug: T182050 Change-Id: I51e54058194cf1bc8398dc78136423d10108a0e9
* Pass `allowEditTags` config through to multiselect widgetsThalia2023-04-182-0/+7
| | | | | | | | | | TitlesMultiselectWidget and NamespacesMultiselectWidget both default to false, meaning click-to-edit on the tags is disabled. Allow this to be overridden from the corresponding PHP form fields. This helps to provide a workaround for the related bug: T334711 Change-Id: I4014c5ba7fea0647da6ec6c420342a41ac90518b
* Fix even more PHPStorm inspections (#3)Tim Starling2023-03-251-1/+2
| | | | | | | | | | | | | | | * Inappropriate @inheritDoc usage. Arguably all @inheritDoc is inappropriate but these are the ones PHPStorm flags as misleading due to the method not being inherited. * Doc comment type does not match actual argument/return type. * I replaced "@return void|never" with "@return void" since never means never, it doesn't make sense for it to be conditional. If a method can return (even if that is unlikely) then @return contains the type that it returns. "@return never" means that there is no such type because the method never returns. * Incomplete/partial/broken doc tags Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
* Fix more PHPStorm inspections (#2)Tim Starling2023-03-251-16/+8
| | | | | | | | | | | | | | | * Illegal string offset and invalid argument supplied to foreach, due to incorrect type information * Array internal pointer reset is unnecessary * $hookData unused since MW 1.35 due to incomplete revert * array_push() with single element * Unnecessary sprintf() * for loop can be replaced with str_repeat() * preg_replace() can be replaced with rtrim() * array_values() call is redundant * Unnecessary cast to string * Unnecessary ternary. Often the result relies on short-circuit evaluation, but I find it more readable nonetheless. Change-Id: I4c45bdb59b51b243fa96286bec8b58deb097d707
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* htmlform: Handle null from HTMLFormField::getDefault in multiselectsUmherirrender2023-02-254-4/+4
| | | | | | | | | | | | HTMLFormField::getDefault is documented to return mixed, which includes null, but WebRequest::getText is documented to allow strings only. The use of WebRequest::getText cannot be replaced with WebRequest::getVal in the multiselects, because there are working with \n and WebRequest::getText provides normalisation for \r\n Bug: T330526 Change-Id: I5df0141fb254a7e2939994daa9ded1a7a126231a
* Override getInputWidget in multiselect HTMLForm fieldsDaimona Eaytoy2023-02-213-3/+24
| | | | | | | Since this method exists, it seems conceptually wrong not to override it in the subclasses. This also makes the field types easier to extend. Change-Id: I655a94944805079de670d4e568e4e8d2b7a9bb8b
* HTMLUsersMultiselectField: Fix documentation of default valueDaimona Eaytoy2023-02-211-1/+1
| | | | | | The value should be a newline-separated string, not an array. Change-Id: Ief6a1262d482407321f18912181f2960ac7820cd
* Merge "Reorg: Move HTML-related classes out of includes/ to Html/"jenkins-bot2023-02-2113-0/+19
|\