Commit graph

62 commits

Author SHA1 Message Date
Bartosz Dziewoński
d302cb2de8 Move HTMLForm-specific styles out of mediawiki.legacy.shared
Bug: T89981
Change-Id: Idcd20b4a776fe6741462b09885e05d1e08f67334
2015-08-19 22:20:21 +02:00
jenkins-bot
7a6b211c48 Merge "Revert "Use OOUI HTMLForm for Special:Watchlist"" 2015-07-30 19:05:20 +00:00
Legoktm
8fd9634774 Revert "Use OOUI HTMLForm for Special:Watchlist"
Issues with spacing (T107311), probably shouldn't have
been merged right before the branch cut.

This reverts commit 9508c5bd57.

Change-Id: Ibf2ca5a33b8ab0f7381c720c6c92fbfd7a7c819d
2015-07-30 18:55:20 +00:00
Bartosz Dziewoński
deb0bd858a HTMLForm: Correct documentation
Change-Id: I84f4d886907b2ae988956563fda48e78afb3cfa6
2015-07-29 00:52:17 +02:00
Florian
9508c5bd57 Use OOUI HTMLForm for Special:Watchlist
Bug: T99256
Change-Id: I47a8649208279a4090623a3088112fcff9abc4d3
2015-07-27 20:15:15 +00:00
Kunal Mehta
ba7acbe791 Allow HTMLTitleTextField to work on GET forms
Just skip validation if it is a GET form and the current input is an
empty string. Callers will need to check that it is not the empty string
though.

Also make sure HTMLForm::mMethod is always lowercase.

Change-Id: I605f32048fe97eebd7e04b6ffd799759aeb7f31e
2015-07-24 18:19:36 -07:00
Florian
3f7443df86 HTMLForm: Allow to set the primary flag for submit buttons
Currently, every submit button generated by HTMLForm itself (not via
the descriptor) doesn't have the primary flag and there is no (easy) way
to add it, although this generated submit button is most likely the primary
one.

Add a new function HTMLForm::setSubmitPrimary() to allow a form to set
add the primary flag to this submit button.

Change-Id: I3ce363f995389a87764edb586b4b64ab2b77b0db
2015-07-23 21:48:35 +02:00
Florian
c226b13545 Implement UserInputWidget in OOUI/MW Widgets
To use OOUI for forms with user name autocomplete, the new widget
UserInputWidget interacts like the jQuery pendant (working with css
class "mw-autocomplete-user").

It is also available in HTMLForm as "user".

Example usage: Iaeff912e6437d6ebef0d5b1919ce8cf53a7fd5f1

Change-Id: I9501c85f4288c255bbe3a5284e99b57b6169916f
2015-07-20 06:11:16 +02:00
jenkins-bot
77594dc2ba Merge "HTMLForm: Add 'title' type" 2015-07-16 18:33:13 +00:00
Bartosz Dziewoński
b524a4333f OOUIHTMLForm: Support setWrapperLegend()
Changed FormSpecialPage not to call setWrapperLegend() for OOUI
forms to preserve current default behavior.

Bonus:
* Correct documentation of setWrapperLegend() to state that it
  HTML-escapes legend text.
* Remove hard-coded class="visualClear" in getFormAttributes().
* Allow setWrapperLegend( true ) to display the wrapper without
  legend text.
* Rejigger things so that we can put the legend and "header HTML"
  into correct order.

Bug: T103026
Change-Id: I847c5e18ae5469aa3a68cc9fa37b2a6614476ca2
2015-07-13 19:20:08 +02:00
Kunal Mehta
d7d663bc54 HTMLForm: Add 'title' type
HTMLTitleTextField will automatically validate title input, can
optionally ensure the title is in a specific namespace, is creatable, or
already exists.

The field currently doesn't support GET requests since validation on
empty strings fails.

Bug: T104420
Change-Id: I45718462570d0a523a148c3830b1116b634df050
2015-07-09 15:44:09 +00:00
Bartosz Dziewoński
552568c63d OOUIHTMLForm: Correctly handle submit modifier flags
Rejigger some HTMLForm internals to remove the hardcoded assumption of
using 'mw-ui' classes.

Bug: T98903
Change-Id: Icc20453c999c761b87e19a71ccd43d93b9c1bfa7
2015-06-27 13:14:08 +00:00
Florian
fd10cd5b95 Use HTMLForm for Special:Export
* Transform all input fields to use HtmlForm as preparation for enabling
  MediaWiki UI eveywhere.
* Remove protected whitespace for HTMLCheckField (adds empty line to div-layout)
* Add a new HTMLForm input field "Text with Button" and "Namespaceselector with Button"

Bug: T73434
Change-Id: I53cc019c3ca94cec8f3c05500d0c604c1af7f688
2015-06-14 16:48:26 +00:00
Florian
091936eb2e HTMLForm: Break long lines
Change-Id: Ia09a28ccc361d1a54069bd23a412831fe9c20f34
2015-06-05 03:12:35 +02:00
Kunal Mehta
ede0147134 HTMLForm::factory() doesn't throw MWExceptions
Change-Id: I0104bf1dd9ebb813aa37f92b21515a964ca2a709
2015-05-27 22:37:33 -07:00
jenkins-bot
5eda39e04b Merge "Implement OOUI display format for HTMLForm" 2015-05-24 12:22:29 +00:00
Mark Holmquist
e85bd04bcd Implement OOUI display format for HTMLForm
Bug: T85291
Change-Id: I6ffe93c16d6b209a0ab08d714ad8ddaefb6acd52
2015-05-23 16:10:08 +02:00
Daniel A. R. Werner
def394bea7 Added documentation for HTMLFormField's "hide-if"
Change-Id: I410c58dc0586cfe97e39668c9608ce0d9e10a08b
2015-05-18 22:16:58 +00:00
jenkins-bot
8b82353738 Merge "Use HTMLForm for Special:LinkSerach" 2015-05-07 01:25:01 +00:00
Bartosz Dziewoński
9172be5a0c HTMLForm: Add wfDeprecated to isVForm
Change-Id: Idd8eb9cf63794c5a71439c130ad28564e6d3e750
2015-05-01 22:17:50 +00:00
Florian
e072d7bd8c Use HTMLForm for Special:LinkSerach
* Convert Special:LinkSearch to use HTMLForm for preparation of MediaWiki
  UI everywhere
* Add support for dir= tag in HTMLTextField

Bug: T73439
Change-Id: I8503c391a40f1654f8570578a9de9015d86c9845
2015-04-19 21:10:45 +02:00
Florianschmidtwelzow
e4f5c50652 Use HTMLForm for Special:FileDuplicateSearch
* Prepare the usage of MediaWiki UI.
* Add new HTMLForm output mode "inline" (very close to "raw")

Bug: 71436
Change-Id: I12240aaf624dff5219b344648b20373594b5ec46
2015-03-29 17:23:12 +02:00
Bartosz Dziewoński
f338a1cf31 HTMLForm: Separate VForm code to a subclass
…and in general, work with the existing HTMLForm design for defining
display formats, rather than against it.

Breaking changes:
* HTMLForm::isVForm() is now deprecated.
* You can no longer do this:
    $form = new HTMLForm( … );
    $form->setDisplayFormat( 'vform' ); // throws exception
  Instead, do this:
    $form = HTMLForm::factory( 'vform', … );
  When using FormSpecialPage, override the new getDisplayFormat() method
  instead of calling $form->setDisplayFormat() in the alterForm() method.
  (Other display formats are not affected, only 'vform'.)

Bug fixes:
* Correctly suppress empty labels for VForm fields
* Correctly disable <fieldset/> wrappers for VForms

Other benefits:
* Reduce code duplication related to $getFieldHtmlMethod
* Introduce HTMLForm::factory() method for constructing HTMLForms

Related cleanup:
* Correctly style 'reset' buttons in MediaWiki UI mode
* Label $wgHTMLFormAllowTableFormat as a mobile-specific hack
* Display checkboxes normally in MediaWiki UI mode (removed weird
  override that only broke things). Also, always render checkboxes
  in VForms as .mw-ui-checkbox.
* self:: → static::

Bug: T85285
Change-Id: I086a84f1c8cc6a16710709b7806c7f5f96462b32
2015-01-14 19:33:34 +00:00
umherirrender
cbdc6e53fe Make HTMLForm::formatErrors non-static to can parse message in context
One call in core already called it non-static

Avoid:
[GlobalTitleFail] MessageCache::parse called by
Message::toString/Message::parseText/MessageCache::parse with no title
set

Change-Id: Ic91e715177c0a4578825640a31ec68ecba3176e0
2014-12-19 16:31:55 +01:00
Kunal Mehta
4603f28025 Avoid GlobalTitleFail in HTMLFormField::__construct
Pass the HTMLForm parent instance in the constructor so context
is available when parsing a message.

Change-Id: I532c0d95698cbcc57294b9bd2725f33838f393a9
2014-12-17 14:20:14 -08:00
Florianschmidtwelzow
317345b0df SpecialNewpages: Prepare for mw-ui
Use HTMLForm instead of self-built table structure, to be
prepared for use with MediaWiki UI.

Bug: 71446
Change-Id: I5c03dc543b910aab27a26a5a223341be50893cf3
2014-10-15 23:25:11 +02:00
Matthew Flaschen
c1bf30c2e5 Fix input regression affecting HTMLForms that use VForm
Although the classes (e.g. mw-ui-input) are still there,
the style module was not being loaded.

This affects forms that deliberately use VForm even without
wgUseMediaWikiUIEverywhere (since they pre-date it).

This applies at least to PasswordReset, which was added in
d32891d99f (last October).

Bug: 71448
Change-Id: Ieca36c0036d4c93244c533237eddd678564dd3c0
2014-10-01 02:17:42 -04:00
Prateek Saxena
930dcafb09 HtmlForm: Add @since annotation for methods added to UI standardization
Change-Id: I74f58df9de79d2ad055eaf9760763005996dc0a0
2014-09-24 18:23:33 +00:00
Prateek Saxena
279d4e2883 Special:BlockList: Use mw-ui-progressive for search button
Bug: 71144
Change-Id: I56969edb6651a26ff2579e1ed9f9da34a9536e46
2014-09-23 15:24:51 -07:00
jdlrobson
274978205c Correct button colours of preference page when $wgUseMediaWikiUIEverywhere is enabled
* Apply mw-ui-destructive to Special:Preferences/Reset
  when $wgUseMediaWikiUIEverywhere is enabled

Introduces HTMLForm->setSubmitDestructive()

Bug: 65317
Change-Id: I1d6691dce3e7dab662bda9a718e16c5caee6c041
2014-09-17 00:00:38 +00:00
jenkins-bot
38d59dd213 Merge "Improve hidden field validation" 2014-09-16 00:10:13 +00:00
Bryan Davis
dd107dda96 Apply vform styling to HTMLForm buttons
Check for isVForm() and apply styling matching the default submit button
when generating alternate form submit buttons.

Change-Id: Ia3313087248af1537ac4740694846b6ff1187b1a
2014-09-05 15:56:19 -06:00
umherirrender
63dc5abc9a Fixed spacing
- Added space after reserved words: function, foreach, if
- Combined 'else if' into elseif
- Added braces to one-line statements
- Added spaces after comma, before parentheses

Change-Id: Ie5bbf680d6fbe0f0872dab2700c16b1394906a72
2014-08-27 18:31:50 +02:00
Brad Jorsch
f637ad308f Add HTMLAutoCompleteSelectField
This is much like the one OAuth has in
Special:OAuthConsumerRegistration/propose, except it stores the
autocompletion options in a data property rather than a global and uses
jquery.suggestions rather than jquery.ui.autocomplete.

Change-Id: I42473cea75f3706cc0125167f9191275ca6cb3b0
2014-08-26 15:14:23 -04:00
Kunal Mehta
1d20719c72 includes/htmlform/: Use Config instead of globals
Change-Id: Ibc798f3ee22dec0a77bab39611d490c09b3cb764
2014-08-23 22:09:15 -07:00
jenkins-bot
28fdbd9ea2 Merge "Add blanket support for mediawiki ui via globals" 2014-08-16 00:48:19 +00:00
jdlrobson
aa15d5287d Add blanket support for mediawiki ui via globals
This provides better mobile experiences on various pages
and a more consistent UI across both mobile and desktop.

It does this in two ways.

1) Forces HTMLForms to not use table based layouts so as
not to interfere with responsive nature of mediawiki ui elements

2) Applies MediaWiki.UI classes to most pages
If a page is created via Xml or Html classes it will use mediawiki ui
Where possible I've added classes unconditionally, but for cases of buttons
this is behind the $wgUseMediaWikiUIEverywhere global since button styling is
enabled on pages by default and for checkboxes since it is changes HTML markup.

3) Adds all MediaWiki.UI styles to pages which can use it
When enabled:
* Apply these styles to all pages which use HTMLForms
* Apply to EditPage
* Apply to anything that uses certain elements outputted by the
Xml or HTML helper classes
* Apply to History page
* Apply to protection page
* Apply to move page
* Apply to deletion page

Currently kept behind a global to allow us time to finetune
existing elements. After further testing we will look to kill the
globals and make mediawiki.ui the default

See: I430c0fbb79d2a33bb828b2427bda0ee01115d73f
Change-Id: I47db5eab4569514d039261d11b6dedb0eeae17b5
2014-08-15 14:48:00 -07:00
jenkins-bot
a15fe7dd93 Merge "Turn HTMLBlockedUsersItemSelect into HTMLSelectLimitField" 2014-08-15 21:40:32 +00:00
Brad Jorsch
788526c2d1 Improve hidden field validation
Hidden fields are supposed to be ignored during validation; more
completely ensure this by checking in HTMLForm::trySubmit before calling
validate.

Also, more properly handle HTMLCheckFields in the isHidden check by
casting their booleans to strings.

Bug: 68132
Change-Id: I84f8239c299727b773015643048eed4684417733
2014-07-31 14:04:00 -04:00
umherirrender
a8d4bfaa83 Allow message object on HTMLForm::setWrapperLegendMsg/setSubmitTextMsg
When a message needs plural support, it should be possible to parse a
message object with the params set.

Change-Id: Ifb67952b589a1821cde452b2be3f327f24e6b534
2014-07-27 17:16:22 +02:00
umherirrender
b883e8c7c0 Cleanup some docs (includes/[e-l])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
Derric Atzrott
0cda6a5182 Adding css styling option for help option in HTMLForm
There is now a new option named csshelpclass that can be passed in form
descriptors for HTMLForm objects.  This option accepts a css class and
applies it to the help text that is provided with the help option in the
form descriptor.

Bug: 65087
Change-Id: If1bd1d12a9159895f45c9cf0fbb7992e4c7e3526
2014-07-16 20:17:07 -03:00
Kunal Mehta
22906ba398 Turn HTMLBlockedUsersItemSelect into HTMLSelectLimitField
Makes it a "real" HTMLForm option that other code can re-use

Change-Id: If0fb7332daf991b790bbf87e825229dccb10b360
2014-07-13 22:44:39 +00:00
Alexandre Emsenhuber
3de2f5a64d Allow to set a salt for the edit token in HTMLForm
And set one in RevertAction.

Change-Id: I9f72c6203e8d9d0770009083263ddca98845f530
2014-07-08 22:45:14 +02:00
Brad Jorsch
0188fe7d5e HTMLForm submission callback documentation updates
The possibilities for the submission callback return value were
documented in three different places, and none were entirely correct.
Related documentation could also use a cleanup.

Change-Id: Ib3621a0d5ba24c481f3117b547bca70d4ca50ba2
2014-07-03 11:21:55 -04:00
umherirrender
b6ed42da0a Remove HTMLForm::addJS() (deprecated since 1.18)
Change-Id: Id174d37b69a2e8d76555c3d414fdb87c01222d66
2014-06-24 19:59:44 +02:00
Thiemo Mättig
f6cff5e392 Update documentation of what a "section" is
There are so many slightly different understandings of what a
"section" is or can be. I'm aware the documentation was improved
just a few weeks ago. I still find it incomplete and confusing.

1. I renamed it to $sectionId to make it more clear what it
really is.

2. Sections are usually numbers. 0, 1 and so on. There is no
reason to disallow the use of ints or even floats (this works
because the string representation of 0.0 is "0"). The code never
disallowed numbers.

3. 'T1' never was supported, as far as I can tell. 'T-1' is
supported. See Parser::extractSections().

4. null and false and '' all mean "the whole page" in
WikiPage::replaceSectionAtRev() but for some reason this meaning got
lost in WikitextContent::replaceSection(). I made it the same again.

Change-Id: Icc3997722d2ed742bf7703cd7c06d09199225720
2014-06-12 18:13:23 +02:00
Brad Jorsch
e9d4d06276 HTMLForm: Add "cloner" type
SecurePoll is going to need the ability to have a form for stuff like
"one or more admin usernames" and "one or more poll questions, each with
one or more options".

This change implements a generic field container that simply displays as
a <ul> followed by an "add more" button, with each <li> containing
various fields including a "remove" button.

Since this is only going to show up in SecurePoll to people creating a
poll (not to general users), the current design is functional but not
necessarily beautiful. Those interested in beauty are welcome to do so
in a followup change.

Change-Id: I46fad3971739ddc961259fe32eb6e1cd265a1c06
2014-05-02 15:02:40 +00:00
Siebrand Mazeland
f994817f6b Pass phpcs-strict on various files in includes/
These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23
2014-04-24 21:50:01 +02:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00