aboutsummaryrefslogtreecommitdiffstats
path: root/includes/widget
Commit message (Collapse)AuthorAgeFilesLines
* Merge "htmlform: Add HTMLOrderedMultiselectField for use in HTMLForm"jenkins-bot2025-02-201-0/+32
|\
| * htmlform: Add HTMLOrderedMultiselectField for use in HTMLFormSiddharth VP2025-01-091-0/+32
| | | | | | | | | | | | | | | | | | | | | | 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
* | htmlform: Disallow reordering options in HTMLMultiSelectField with dropdownBartosz Dziewoński2025-01-081-0/+7
|/ | | | | | | | 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
* htmlform: support namespace parameter for titlesmultiselect fieldsSiddharth VP2024-12-291-0/+18
| | | | Change-Id: If9217731be62694a0d953f6405da7677131315ad
* Merge "Support sections in the dropdown mode of HtmlMultiSelectField"jenkins-bot2024-12-162-9/+63
|\
| * Support sections in the dropdown mode of HtmlMultiSelectFieldFunc2024-12-162-9/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-142-0/+2
|/ | | | | | | | | | | | 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
* NamespaceInputWidget: Correctly set default for 'include'Dreamy Jazz2024-11-011-2/+4
| | | | | | | | | | | | | | | | | | | | Why: * In 5617115fe22337ba464bd6b253c1d2af941b2adc, the NamespaceInputWidget class was modified to support filtering out all namespaces but a specified few. * The modifications to the ::__construct method incorrectly set the default for this include list as an empty list, which meant that by default all namespaces were excluded. * This commit fixes that to instead make the default null, which does not apply any filtering. What: * Fix NamespaceInputWidget::__construct to correctly set the default for the 'include' configuration value. * Add regression tests with this fix. Bug: T378810 Change-Id: Ie00483641cf058b4522b60a72393a8f1ba4d15a1
* Support 'include' parameter in namespace select inputsSTran2024-10-301-2/+7
| | | | | | | | | | | | | | | | | 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/+46
| | | | | | | | | | | | | | | * 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-149-0/+37
| | | | | | | | | | 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
* Add "implements Stringable" to every class with "function __toString()"Bartosz Dziewoński2024-06-131-1/+2
| | | | | | | | | | | | | In PHP 8, but not in PHP 7.4, every class with a __toString() function implicitly implements the Stringable interface. Therefore, the behavior of checks like "instanceof Stringable" differs between these PHP versions when such classes are involved. Make every such class implement the interface so that the behavior will be consistent. The PHP 7.4 fallback for the Stringable interface is provided by symfony/polyfill-php80. Change-Id: I3f0330c2555c7d3bf99b654ed3c0b0303e257ea1
* Refactor widget classes to use cleaner namespacingDogu2024-01-0212-30/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch refactors various widget classes in the includes/widget directory to use cleaner namespacing. The patches remove redundant backslash prefixes in class extending statements and add use statements for OOUI classes and other MediaWiki-specific classes. This patch improves readability and maintainability of the code by following the MediaWiki coding conventions and leverages the benefits of PHP's namespacing system. List of affected classes: - CheckMatrixWidget - DateInputWidget - DateTimeInputWidget - NamespaceInputWidget - SearchInputWidget - SelectWithInputWidget - SizeFilterWidget - SpinnerWidget - TagMultiselectWidget - TitleInputWidget - UserInputWidget Additionally, the code now correctly documents exceptions thrown by constructors where missing, enforcing clearer developer expectations. Change-Id: I0fdaf68a412a1c3b7049a79222f4dbeaa95a6bbc
* Refactor ComplexNamespaceInputWidget to use namespaced OOUI classesDogu2024-01-021-5/+12
| | | | | | | | | | | This patch refactors the ComplexNamespaceInputWidget class to use fully qualified class names for OOUI components. It removes the manual specification of the OOUI namespace within the class and instead relies on the `use` declarations at the top of the PHP file. Additionally, it adds the Exception class to the list of used namespaced classes, preparing for explicit exception handling. Change-Id: I3fe255f491979b63b5361da69a87c32b4fa65b5f
* htmlform: Support HTML tooltips in checkmatrixGergő Tisza2023-11-061-1/+12
| | | | | | Bug: T290790 Bug: T254222 Change-Id: I69e8217c408acca6bd7f19e7e274b255336dccd2
* Implement HTMLToggleSwitchField for mobile layout of preferencesFunc2023-05-181-0/+25
| | | | | | | | | | | 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
* Merge "Set autocapitalize on Special:Search input"jenkins-bot2023-05-161-0/+5
|\
| * Set autocapitalize on Special:Search inputErik Bernhardson2023-05-081-0/+5
| | | | | | | | | | | | | | | | | | | | Capitals are meaningful on some wikis, and they call it out with $wgCapitalLinks. Match the autocapitalization behaviour with this. This is mimicing the same functionality as applied to the skin autocomplete, found in SkinComponentSearch. Bug: T335551 Change-Id: I98c39061cd7a3d601f5380edd9730bf61f8339fd
* | Pass `allowEditTags` config through to multiselect widgetsThalia2023-04-182-0/+19
|/ | | | | | | | | | 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
* TagMultiselectWidget: Set rows to max number of tags if below 10Thalia2023-03-301-1/+1
| | | | | Bug: T333581 Change-Id: I28dafd8894bb6073e5ef1b4419b6777bd6b2580a
* Reorg: Move HTML-related classes out of includes/ to Html/Amir Sarabadani2023-02-162-2/+2
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* Allow setting min/max on DateInputWidgettacsipacsi2022-10-211-10/+18
| | | | | | | | | | | | | This is required for HTMLDateTimeField to be compatible it: HTMLDateTimeField filters out mustBeAfter/mustBeBefore, while DateInputWidget didn’t understand min/max until now. Since moment.js (used by the JavaScript side of the widget) seems to better like the mustBeAfter/mustBeBefore semantics (strictly larger/smaller than) than the min/max one (larger/smaller than or equal to), I decided to internally keep mustBeAfter/mustBeBefore. Bug: T219633 Change-Id: I487363e40d1e4f74780ed7146c8a6770bfc61fae
* Make use of ?? and ?: operators where it makes senseThiemo Kreuz2022-08-041-3/+2
| | | | Change-Id: I1d9d62d80b17d1a05222c6e82f631cb801c311a8
* Support namespace dropdown 'in-user-lang' option in HTMLForm and OOUI widgetBartosz Dziewoński2022-05-131-0/+6
| | | | Change-Id: I3dbb2ec9d3989a1278151090ad81c7fabd3afbde
* Fix many typos in commentsMatěj Suchánek2022-05-101-1/+1
| | | | | | Found using IntelliJ's "Typo" code inspection. Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
* Remove some more comments that literally repeat the codeThiemo Kreuz2021-12-091-2/+2
| | | | | | | | Nothing to learn from these. You can find a longer explanation in the comments in I93751e6. Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
* Remove unreachable code after exception/die/exitUmherirrender2021-09-031-1/+0
| | | | Change-Id: Ia81903fb2a8157625fbe63115097eccc1161b5db
* Remove comments that repeat the codeDannyS7122021-06-021-1/+0
| | | | | | Don't provide any addition information Change-Id: I4f474537056e34bac74b0d0cd5b4beb800664f90
* Add HTMLTagMultiselectFieldSTran2021-03-261-2/+19
| | | | | | | | | | | Implements HTMLTagMultiselectField, a form field that instantiates TagMultiselectWidget, the PHP representation of the OOUI's js-based widget of the same name with the implemented parameters: * allowArbitrary * allowedValues Bug: T278317 Change-Id: I3a6a30506d493be4185f917c577b3837fffd8ae1
* Replace tabs with spacesMatěj Suchánek2020-09-041-1/+1
| | | | Change-Id: Id034c34a294585f58dba58c26db466e0e39cb557
* Clarify documentation of TitlesMultiselectWidget::$showMissingGergő Tisza2020-06-031-1/+2
| | | | | Bug: T254357 Change-Id: Iea2dd47f95bc3b84e8f29dff97d38fb1d989b9c7
* Create a PHP version of jquery.spinnerEd Sanders2020-03-131-0/+68
| | | | Change-Id: I7622b08ec89525d24a4a1a755ffeee1aace9d382
* widgets: Split out SearchWidgets into their own treeJames D. Forrester2020-02-1110-1366/+0
| | | | | | | | | | | | Expecting people to magically know that MediaWiki\Widget\SearchInputWidget is generic and for use on random pages, but MediaWiki\Widget\SearchResultWidget is super-specialised, based on bespoke technologies, and only for use on Special:Search, is not great. None of these are used outside the MediaWiki core codebase and so this change whilst it would otherwise be technically breaking is fine. Change-Id: I16d21dd5e1ac3aa9893863df272d1bbb4788066f
* languages: Introduce LanguageConverterFactoryPeter Ovchyn2020-02-031-1/+3
| | | | | | | | | | | | | | | | | | | Done: * Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter * Remove LanguageConverter::newConverter from all subclasses * Add LanguageConverterFactory integration tests which covers all languages by their code. * Caching of LanguageConverters in factory * Make all tests running (hope that's would be enough) * Uncomment the deprecated functions. * Rename FakeConverter to TrivialLanguageConverter * Create ILanguageConverter to have shared ancestor * Make the LanguageConverter class abstract. * Create table with mapping between lang code and converter instead of using name convention * ILanguageConverter @internal * Clean up code Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf Bug: T226833, T243332
* Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-104-7/+7
| | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
* Merge "Return HtmlArmor for Search ResultSet snippets"jenkins-bot2019-12-131-3/+26
|\
| * Return HtmlArmor for Search ResultSet snippetsErik Bernhardson2019-12-121-3/+26
| | | | | | | | | | | | | | | | | | | | | | Passing around strings that are expected to be safe html and are known to be based on user input is a fairly unsafe operation. Make it harder to do the wrong thing by requiring HtmlArmor to be returned from the ResultSet snippets. This does not address the snippets on individual result objects as the api surface is larger and requires more bc handling. Change-Id: I76231d6fc53c4982eb4cd174d2e6a75eb2740497
* | build: Upgrade phan to 0.9.0Daimona Eaytoy2019-12-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scalar casts are still allowed (for now), because there's a huge amount of false positives. Ditto for invalid array offsets. Thoughts about the rest: luckily, many false positives with array offsets have gone. Moreover, since *Internal issues are suppressed in the base config, we can remove inline suppressions. Unfortunately, there are a couple of new issues about array additions with only false positives, because apparently they don't take branches into account. Change-Id: I5a3913c6e762f77bfdae55051a395fae95d1f841
* | Remove duplicate variable name from class property PHPDocsThiemo Kreuz2019-12-021-7/+7
| | | | | | | | | | | | | | | | | | | | | | Repeating the variable name doesn't do anything. Documentation generators don't need it. It's more stuff to read that doesn't add new information. And it can become outdated. Note there are two types of @var docs. When used inline (and not on a class property) the variable name is needed. Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
* | Improve param docsUmherirrender2019-11-281-8/+9
| | | | | | | | Change-Id: I746a69f6ed01c3ff000da125457df62b02d13b34
* | Add option for showing valid IPs in UsersMultiselectWidget menuThalia2019-11-151-0/+35
|/ | | | | | | | | Pass through config options from HTMLUserTextField that allow the field to accept an IP address and/or range, and specify the maximum allowed range size. Bug: T238277 Change-Id: I0e0f6b6fd6801d5cd561def28917e81a81b3f7d4
* phpcs: Enable PSR12.Files.ImportStatement.LeadingSlash and make passUmherirrender2019-10-111-3/+3
| | | | Change-Id: Ifaa7bef925cc4e1b3f1751bb66abdda7fe6763d8
* Merge "Fixup phan warning toomanyparams (part 2)"jenkins-bot2019-10-101-1/+1
|\
| * Fixup phan warning toomanyparams (part 2)Daimona Eaytoy2019-10-101-1/+1
| | | | | | | | | | Bug: T231636 Change-Id: Idde7a766bb0d084d6b67bb0c940d7ad704847ad2
* | Unsuppress PhanParamReqAfterOpt, use PHP71 nullable typesDaimona Eaytoy2019-10-101-1/+1
|/ | | | | | | | | | | These were all checked with codesearch to ensure nothing is overriding these methods. For the most part, I've updated the signature to use nullable types; for two Pager's, I've just made all parameters non-optional, because you're already forced to pass them with a required parameter at the end. Bug: T231636 Change-Id: Ie047891f55fcd322039194cfa9a8549e4f1f6f14
* widget: Improve properties documentationDaimona Eaytoy2019-09-106-42/+54
| | | | | | | | Explicitly declare all dynamic properties. Add docblocks for several props. Remove the defaults when they're already set in the constructor. Make TagMultiselectWidget use ?? like other widgets. Change-Id: I889bf6f9e1bbe381f5bffb8ce1370c9e2e863520
* Unsuppress phan issues part 6Daimona Eaytoy2019-09-011-0/+1
| | | | | | Bug: T231636 Depends-On: I50377746f01749b058c39fd8229f9d566224cc43 Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9
* Unsuppress other phan issues (part 4)Daimona Eaytoy2019-08-311-0/+1
| | | | | | Bug: T231636 Depends-On: I58e67c2b38389df874438deada4239510d21654f Change-Id: I6e5fba7bd273219b1206559420b5bdb78734aa84
* Merge "Allow SelectWithInput to be marked as required and handle that ↵jenkins-bot2019-07-311-1/+7
|\ | | | | | | dynamically"
| * Allow SelectWithInput to be marked as required and handle that dynamicallyDavid Barratt2019-07-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | Alters the SelectWithInput to allow a required config to be passed from a parent widget. Also handles the required state dynamically. If the widget is an OR widget, then only the select dropdown is required. The text input will be required when the other option is selected. If the widget is an AND widget then both the select dropdown and the text input will be required. Bug: T220533 Change-Id: I8479743126756f2b1bd7bcd53b100a0134f34d07