aboutsummaryrefslogtreecommitdiffstats
path: root/includes/htmlform/fields
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/changetagsJames D. Forrester2025-03-251-1/+1
| | | | | Bug: T353458 Change-Id: I3cf44dfe5425f2efb8409c83571c427447b053af
* Merge "htmlform: Add HTMLOrderedMultiselectField for use in HTMLForm"jenkins-bot2025-02-201-0/+59
|\
| * htmlform: Add HTMLOrderedMultiselectField for use in HTMLFormSiddharth VP2025-01-091-0/+59
| | | | | | | | | | | | | | | | | | | | | | This field uses a new widget based on OO.ui.MenuTagMultiselectWidget to allow choosing from multiple options in a dropdown. It internally uses a textarea ensuring that order of selected chips are preserved. No-JS fallback is a textarea with no dropdown, but validations ensure that arbitrary values entered are not accepted. Bug: T382995 Change-Id: I4c8548a820c6035b28efdb47df8d7cbeeb407031
* | HTMLFormField: factor out label escapingTim Starling2025-02-132-15/+9
| | | | | | | | | | | | | | Provide protected helper methods for conditional escaping of labels. Complain about the situation in a comment. Change-Id: I32b3ebc5eb2d0892f2204a09a74ed00ee5274811
* | Replace call_user_func with dynamic function callUmherirrender2025-02-133-5/+5
| | | | | | | | | | | | | | | | Use modern php syntax to call a callable. Reduce the stack trace to improve performance and better IDE and static analyzer support Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
* | Merge "htmlform: fix defaults for namespace and relative in titlesmultiselect"jenkins-bot2025-01-141-4/+2
|\ \
| * | htmlform: fix defaults for namespace and relative in titlesmultiselectSiddharth VP2025-01-121-4/+2
| |/ | | | | | | | | | | | | | | | | | | | | HTMLTitleTextField uses a default value of `false` for namespace and relative fields, hence the isset() checks in HTMLTitlesMultiselectField getInputOOUI() are always true. Make the handling of these fields consistent with HTMLTitleTextField::getInputWidget() which checks namespace whether is false, and makes no check for relative. Bug: T383133 Change-Id: Ie5443a2fcad4c9229f358fef0b4e3cb069ad3043
* | Merge "htmlform: Disallow reordering options in HTMLMultiSelectField with ↵jenkins-bot2025-01-101-0/+1
|\ \ | | | | | | | | | dropdown"
| * | htmlform: Disallow reordering options in HTMLMultiSelectField with dropdownBartosz Dziewoński2025-01-081-0/+1
| |/ | | | | | | | | | | | | | | The backend of HTMLMultiSelectField does not allow reordering options, so set `allowReordering: false` so that the frontend doesn't either. Bug: T383277 Change-Id: Ie0fabe3537c76238dc144c9a958ac965b998ea5b
* | Merge "build: Upgrade mediawiki/mediawiki-phan-config from 0.14.0 to 0.15.0"jenkins-bot2025-01-101-0/+1
|\ \
| * | build: Upgrade mediawiki/mediawiki-phan-config from 0.14.0 to 0.15.0James D. Forrester2024-12-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppress remaining issues Depends-On: I633ec05fe9ab6a815225911d942ecb79f21c428f Depends-On: I186e799256fbaf5ee77558bd146f9418dd5eaacc Depends-On: Ib84b7d71e8308a36409f30ecfd16e9de149e97b3 Depends-On: I26aa4adf31b4142248abe3e0f9aa8314512602a6 Depends-On: Icf24e208a487bafe3d1983536870aac19cfc4b5e Depends-On: I99915b893f14cfbb2b54d9a6264b4f294200c4f2 Depends-On: Ia53b71dff3299837856ae3c004cd0227bd45e05b Change-Id: I825dce05d4a6ca87acf25063e3664cb2d16f5db0
* | | Use getRawVal instead of getValFomafix2025-01-091-1/+1
| |/ |/| | | | | | | | | | | | | If the value is compared against a static ASCII string. The UTF-8 normalization of getVal is not needed here. Change-Id: Id85f1218a9d76b9ca69fb833348e531387089711
* | htmlform: ensure at least 1 selection for required multiselect fieldsSiddharth VP2024-12-301-0/+7
| | | | | | | | Change-Id: Id6f9a2bfaa94ac97a635a23410e4b2efaf19ce95
* | htmlform: support namespace parameter for titlesmultiselect fieldsSiddharth VP2024-12-291-0/+6
|/ | | | Change-Id: If9217731be62694a0d953f6405da7677131315ad
* Merge "htmlform: Replace isset() with null check"jenkins-bot2024-12-181-1/+1
|\
| * htmlform: Replace isset() with null checkUmherirrender2024-12-181-1/+1
| | | | | | | | | | | | | | | | | | isset() should only be used to suppress errors, not for null check. When the property is always defined, there is no need to use isset. Found by a new phan plugin (2efea9f989) https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset Change-Id: I633ec05fe9ab6a815225911d942ecb79f21c428f
* | HTMLCheckMatrix: Set `vertical-label` instead of overriding `getTableRow`Func2024-12-191-45/+3
|/ | | | Change-Id: I36a5cebb63ef047bcf276553a9f18b62c80f8e88
* Merge "Support sections in the dropdown mode of HtmlMultiSelectField"jenkins-bot2024-12-161-46/+61
|\
| * Support sections in the dropdown mode of HtmlMultiSelectFieldFunc2024-12-161-46/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | Created a new input widget and used it for the dropdown mode of HtmlMultiSelectField. Dropped the `mw-htmlform-dropdown` class to avoid being affected by old site/user js/css targeting it. Also, generalised the creation of no-js fallback implementation, so subclass of TagMultiselectWidget can provide a friendly interface suited for their options' data. Bug: T380995 Change-Id: Ieeb02ad875c6932cf594de6585cdda79771f7e50
* | widget: Add pending state to Date(Time)InputWidgetDaimona Eaytoy2024-12-141-0/+1
|/ | | | | | | | | | | | Use PendingTextInputWidget to provide a "loading" state and avoid the ugly transition from the vanilla input field to OOUI. Make sure the no-JS version never sees the pending state. Based on the implementation in TagMultiselectWidget. Bug: T382186 Change-Id: Iebb497a9c4cfb2c7b76fb4ffb7709e05c77a068a
* Merge "htmlform: Implement `max` parameter in HTMLMultiSelectField"jenkins-bot2024-11-271-3/+12
|\
| * htmlform: Implement `max` parameter in HTMLMultiSelectFieldDaimona Eaytoy2024-11-211-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Can be used to specify a maximum number of selectable items. Server-side, the constraint is always checked upon form submission (in `validate()`), regardless of other options. Client-side, this is only implemented in the dropdown version (OOUI's MenuTagMultiselect), because CheckboxMultiselectInputWidget does not support any bounds on the number of selected elements. Bug: T380406 Change-Id: I26845cc215186fc4993cd7cba84222696dc06d81
* | Support custom sets of tags in HTMLTagFilterSTran2024-11-251-3/+42
|/ | | | | | | | | | | | | | | Why: Allow for the `HTMLTagFilter` widget to be customized by passing through the parameters which should be used for the select input's options. What: - Support passing an `isActive` parameter to display all tags (`false`) or only active tags (`true`) - Support passing a `useAllTags` parameter to use all on-wiki tags ('`true`) or only software-defined tags (`false`) Bug: T378622 Change-Id: I73b5566fd54e416cc01fa53f5463a7dd785f857f
* Support 'include' parameter in namespace select inputsSTran2024-10-301-0/+8
| | | | | | | | | | | | | | | | | Namespace select inputs already support an 'exclude' parameter, ignoring any namespaces that match ids in that array. For Special:GlobalContributions, it would be useful to have the opposite - an array of namespaces to be included, as it only wants to support filtering on common namespaces. - Allow an 'include' parameter to be passed through to the namespace select input - Support 'include' in Html inputs and OOUI inputs TODO: Support 'include in Codex inputs (see T378582) Bug: T378179 Change-Id: I4170beb588292fbec26926ca3afe559c25de9f55
* Update user widgets to support named and temp account exclusionJamie Kuppens2024-09-162-0/+27
| | | | | | | | | | | | | | | * This change introduces two new optional parameters to the 'allusers' API call named 'excludenamed' and 'excludetemp' that allows filtering accounts based on whether they're named accounts or temporary accounts. This is tested by using the temporary matchPattern configured with $wgAutoCreateTempUser. * User widgets that call 'allusers' have been updated so that 'excludenamed' and 'excludetemp' can be optionally set so that named or temporary accounts may not returned with user suggestions. Bug: T332030 Change-Id: I6563ae610017fd1cd35c36ba65906041f7f68c4b
* htmlform: Add missing documentation to class propertiesUmherirrender2024-09-1410-0/+16
| | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: I1f306a3925d6768209a06e70082598b2f70cd319
* Use const keyword for constant list of strings or intsUmherirrender2024-09-111-2/+2
| | | | | | Also changed visiblity of some to private Change-Id: I113b040321d27c84fe9b807c162736909e96fb20
* Make use of the ??= and ?? operators where it makes sensethiemowmde2024-08-262-6/+2
| | | | | | | | This touches various production classes and maintenance scripts. The code should do the exact same as before. The main benefit is that the syntax avoids any repetition. Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
* Allow ContributionsSpecialPage to accept usemodwiki IP addressesDreamy Jazz2024-08-191-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * In 19238b429ff00fd872ba035485117ae6a32df64c, the ContributionsSpecialPage class was modified to not perform queries if the submitted form data was not determined to be valid. * This was necessary to allow IPContributions in CheckUser to not run the query if the form was invalid. * However, this broke looking up contributions from IPs that have the UseMod wiki format (i.e. "xxx" instead of the last octet of an IPv4 address) because the HTMLUserTextField class does not consider these as valid IP addresses. * Fixing this is necessary to allow looking up contributions from these IPs in the contribution pagers. What: * Update HTMLUserTextField to have a 'usemodwiki-ipallowed' option that when specified as true will allow IP addresses in with the UseMod wiki format. ** This is done via the regex used by UserDef::processUser which determines if an IP is a UseMod wiki IP ** This option is only used if the 'ipallowed' option is also set to true. * Update ContributionsSpecialPage::getTargetField to specify that the 'target' field should allow UseMod wiki IP addresses. * Add tests for the changes to HTMLUserTextField and also a regression test via SpecialContributionsTest. Bug: T370413 Change-Id: I2b1d981a21c7b85c22a371708776c7ca127dec4c
* HTMLRadioField: clean up HTMLlwatson2024-08-121-1/+1
| | | | | | | | | | | | | | Ensure CodexHTMLForm reflects HTML changes made to Codex components, Radio and Checkbox. - Changed the top level element from `span` to `div` in HTMLRadioField. - Update test in HTMLRadioFieldTest. HTMLCheckboxField already has a top-level `div` so no changes are needed. Bug: T370689 Change-Id: I0b7e5369e23b1a95e431014d7b22f3f1064b3dba
* Use namespaced classes (3)Umherirrender2024-06-164-4/+3
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ia35b2d3105880631dd26ec974068b000ac7f4b6b
* HTMLForm: Remove use of jquery.chosen in HTMLMultiSelectFieldRoan Kattouw2024-06-131-4/+0
| | | | | | | | | | | | | | HTMLMultiSelectField used the jquery.chosen library, but only for the legacy display format, and only if the 'dropdown' option was passed. There is only one form that passes the 'dropdown' option (SpecialActiveUsers), and that form uses the OOUI display format, so this code is unused. Also remove the htmlform-chosen-placeholder i18n message, which is now unused as well. Bug: T53443 Change-Id: Ie4f9fff322ae26fbdf9eae1b3634d1b04e746179
* Import InvalidArgumentException at top of the sourceEbrahim Byagowi2024-05-191-2/+3
| | | | | | | | | | | | | | It was asked in a patch review to apply fully import InvalidArgumentException where possible. I was guessing some of my other already merged patches have but turned out such thing exists other places style so for the sake of consistency I've turned rest of inline import of the specific exception at top of the file. There are instances of source files that aren't in any namespace but have fully qualified import which this patch doesn't touch. Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
* Add namespace and deprecation alias to FormatJsonEbrahim Byagowi2024-05-163-3/+3
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Json to FormatJson and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
* Add namespace and deprecation alias to Xml and XmlSelectEbrahim Byagowi2024-05-1610-10/+10
| | | | | | | | | | This patch introduces a new namespace declaration, MediaWiki\Xml and adds Xml and XmlSelect to it and establishes class aliases marked as deprecated since version 1.43. Bug: T353458 Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
* HTMLSelectNamespace: Add Codex outputRoan Kattouw2024-05-051-0/+15
| | | | | | The Codex implementation wraps HTMLSelectField. Change-Id: I4241cb66d531e359534005b774a0951194a79edd
* Ignore/fix MediaWiki.Commenting.PropertyDocumentation.WrongStyleTaavi Väänänen2024-04-222-2/+2
| | | | | | | | Fix the real issues found by this sniff, and convert the remaining false positive ignores to per-line ignores so that any more real issues won't be added. Change-Id: I18e75d59df327e2d93a3a487c115e92b9f268722
* CodexHTMLForm: Use a static method in getButtons()lwatson2024-04-091-15/+42
| | | | | | | | | | | | | Create a static method that returns the HTML for a Codex button. CodexHTMLForm::getButtons() and HTMLButtonField::getInputCodex() calls the static method and passes in a list of attributes, flags, and the button label needed to build the Codex button. This patch changes the way the Codex submit button is created. In a previous patch, the submit button was an instance of HTMLSubmitField. Bug: T361406 Change-Id: I046de61d4808f034335254e9a9c853f133d66a9b
* CodexHTMLForm: Learn from OOUI HTMLForm layout stylesVolker E.2024-04-041-1/+1
| | | | | | | | - Put select or fields side-by-side and apply form guidelines margin - Put select and fields underneath with correct margins - Indent connected components to Radio above visually Change-Id: I7d262f533122cff5cf6e7be26af40090232c359e
* HTMLButtonField: Remove isBadIE()Volker E.2024-03-291-26/+5
| | | | | | | | Was only there for IE 6 & 7, which are gladly not supported in our infrastructure and codebase for some years now. Bug: T234582 Change-Id: I111ec7c45f04caf82a796b701baf206ebbc0540b
* HTMLRadioField: Fix escaping of options with CodexDaimona Eaytoy2024-03-291-2/+3
| | | | | | | | | | | | | | | | `$this->mOptionsLabelsNotFromMessage` is set when calling `$this->getOptions()`, meaning the previous code wasn't actually seeing its expected value. Compare with the `getInputOOUI` implementation, where the ternary is inside the foreach loop. So, do the same thing for Codex and choose the function to use inside the loop. Also use the full method name in both cases instead of indirect calls, as it makes the code easier to analyze statically (also, the call itself is pretty simple). Follow-up to I73b2e95cff. Change-Id: Ie6b626fa4f9822f76bf202c5ed66ec16c17dc422
* Merge "HTMLForm: Make raw InfoFields work in Codex"jenkins-bot2024-03-281-0/+8
|\
| * HTMLForm: Make raw InfoFields work in CodexRoan Kattouw2024-03-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | HTMLInfoField overrides getDiv(), getTableRow() and getOOUI() to output the raw value if 'rawrow' is set. Override getCodex() too, so that 'rawrow' also works correctly in CodexHTMLForm. This caused a bug where going to Special:UserLogin?warning=mobile-frontend-watchlist-purpose would show a message box that was incorrectly wrapped in a cdx-field div. That seems to have been harmless, but it's incorrect behavior and could cause styling bugs in the future. Change-Id: I1fd4e2e53f9e03561fe300b6924e44cf222db3c9
* | HTMLRadioField: Escape plain text description messagesRoan Kattouw2024-03-251-1/+1
|/ | | | Change-Id: I40c7f93ac5ba71a6a3c8a1caa15da6a6be7e331b
* Merge "HTMLForm: Add per-option descriptions for Codex radio buttons"jenkins-bot2024-03-251-3/+70
|\
| * HTMLForm: Add per-option descriptions for Codex radio buttonsRoan Kattouw2024-03-211-3/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | Add the 'option-descriptions', option-descriptions-messages' and 'option-descriptions-messages-parse' settings to HTMLRadioField, which allow setting descriptions for each option. For simplicity, only support this for HTMLRadioField, and only for Codex. See also T324268 for a previous stalled attempt to implement this for OOUI, which ran into issues. Bug: T359019 Change-Id: I38116bb2fa3086408d3e2b47e5fe020b30f9729a
* | Merge "HTMLButtonField: remove hard-coded button flags in Codex"jenkins-bot2024-03-221-2/+17
|\ \
| * | HTMLButtonField: remove hard-coded button flags in Codexlwatson2024-03-211-2/+17
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for all Codex Buttons by removing the hard-coded values in the flag class array ($flags). This patch adds the `cdx-button` class to class attributes. It maps each flag in `$this->mFlags` array to the corresponding CSS class name and appends each flag class to the flag class array. This ensures that all flag classes defined in $flags are included in the HTML output. Flags include 'progressive', 'destructive', 'primary', and 'quiet'. Flag classes include: - cdx-button--action-progressive - cdx-button--action-destructive - cdx-button--weight-primary - cdx-button--weight-quiet Bug: T359018 Change-Id: I4ceaa3ef484f654bd908479d27ce0d32ed099d86
* / HTMLHiddenField: Support CodexHTMLFormRoan Kattouw2024-03-211-0/+4
|/ | | | | | | | | | | HTMLHiddenField does some black magic by outputting nothing and then adding a hidden field to the form somewhere else. This black magic wasn't updated for CodexHTMLForm, so it broke on forms that use Codex (specifically, the login form, where CAPTCHAs are added using HTMLHiddenField). Bug: T360717 Change-Id: I2faec05d809b926b2ec2dedaceb7c74a445e06b2
* Merge "HTMLFormField: Codex CSS-only version of HTMLRadioField"jenkins-bot2024-03-191-1/+57
|\