Commit graph

243 commits

Author SHA1 Message Date
Aaron Schulz
5cb69843db Made HTMLForm wrap the submit buttons in a container for styling
Change-Id: I6510493a80c18ba5a466a16e3ca39396f9a60f60
2013-09-11 14:47:19 -07:00
Alexandre Emsenhuber
84f64b30fc Add new HTMLForm::addHiddenFields() methods
Allows to set various hidden fields from a single method call;
can be used with:
$form->addHiddenFields( $context->getRequest()->getValues( /* field list */ ) );

Change-Id: I864584e5889297bb680808163f48795bab8f7afb
2013-08-20 20:20:08 +02:00
Mark Holmquist
d51f688f81 Don't display empty preference sections
If a preference section has only hidden or API preferences, there are no
contents. So it would be silly to display a section heading for it,
since the user cannot see anything inside.

Change-Id: Ia1d89032c45a06c5103e50d90f3ef147213dd571
2013-08-14 20:26:33 +00:00
jenkins-bot
44540a52d1 Merge "Fix the target URL of HTMLForm" 2013-07-26 01:11:48 +00:00
Platonides
20f4451345 HTMLCheckMatrix: Create the exceptions to be thrown directly
Instead of using a function to create itself. Just like it's done
everywhere else in the code.

Change-Id: Ib080a3eb2fc2c173f8bf07289beb976824447357
2013-06-30 21:14:18 +00:00
Alexandre Emsenhuber
e932512e46 Remove occurence of $wgOut in HTMLForm::displayForm()'s documentation
Mention the context instead

Change-Id: Ic081abc7ee8b63281d7a4d56fac9333e79e39f29
2013-06-03 10:51:06 +02:00
Erik Bernhardson
f4cfdad6ee Tooltips for HTMLCheckMatrix
Generates tooltips on the columns labels of HTMLCheckMatrix.
Bug: 47094

Change-Id: I9670ecdc2cb553df07ee06e3b83b003382471d27
2013-05-30 10:29:04 -07:00
Alexandre Emsenhuber
aad8dc4c03 Fix the target URL of HTMLForm
- Use a local URL instead of a full one
- Use $wgScriptPath instead of title's URL when $wgArticlePath
  contains a "?" since it'll be removed by web browser
- Move the URL generation to getAction() for better readability
- Use getMethod() instead of mMethod for consistency

Change-Id: I7c40cae839e52e2e8618d48c7a3b2f9709e6f2d6
2013-05-29 06:30:32 +00:00
jenkins-bot
8a839c89a3 Merge "Allow setting the ID of the main table in HTMLForm" 2013-05-28 21:23:44 +00:00
Alexandre Emsenhuber
fcf98dc451 Allow setting the ID of the main table in HTMLForm
- Added new method HTMLForm::setTableId() to allow to set the ID
  of the main table (or the outermost <div> element depending on
  the format).
- Changed the second parameter of HTMLForm::displaySection()
  to take the full ID so that the one set with setTableId()
  will not get prefixed with "mw-htmlform-"

Note: If someone has a better idea for the name of that method
(since it also applies to <div> elements), please tell me it :)

Change-Id: Id01bd0fa44512b0320f3c3ff79627e8a9bccd5bb
2013-05-28 21:05:35 +00:00
nischayn22
f72515cfcf Fieldset legends is broken.
HTMLForm constructor didn't use messagePrefix if context is null.

Bug: 48650
Change-Id: I26367bd597f873838c8cf45d75800661d37c0f95
2013-05-27 14:54:37 +00:00
umherirrender
15ff79312d Fixed spacing and removed unneeded parenthesis
Added spaces after/before parenthesis
Removed unneeded parenthesis around some statements
Broke a long line

Change-Id: I7fbe129f7bbf524dd0598ece2a9708643f08453b
2013-05-17 16:12:08 +00:00
jenkins-bot
e0b187264c Merge "HTMLCheckMatrix support for forcing options on/off" 2013-05-17 00:34:32 +00:00
ebernhardson
3998d1e637 HTMLCheckMatrix support for forcing options on/off
Bug: 47743
Renamed remove-options parameter of HTMLCheckMatrix to force-options-on
and added additional force-options-off. Minor refactor of
PreferencesForm::filterDataForSubmit to move class specific code into their
respective classes.

Change-Id: I61a6b2bcce3102e2350088912ee77620a9f678f9
2013-05-16 17:21:43 -07:00
jenkins-bot
7cc8df605e Merge "HTMLForm entity labels are now optional and escaped" 2013-05-01 01:02:06 +00:00
Matt Walker
4497500e7b HTMLForm entity labels are now optional and escaped
Things like checkboxes have no label, yet a label div gets generated
anyway. This is annoying when maybe I don't want that empty div hanging
around (i.e., it looks like it's part of other option groups when I
have left margins on all .mw-input).

This patch will now also escape 'label' fields by default. For the old
functionality you must now explicitly use the 'label-raw' field.

Change-Id: I8f8340911b7495a91c93e7f2eb7c041b2a7f2179
2013-04-30 17:54:07 -07:00
jenkins-bot
939b104dbb Merge "HTMLTextAreaField: Allow sizes to be overridden by child classes" 2013-05-01 00:49:28 +00:00
jenkins-bot
7f12cf1e11 Merge "Fix HTMLForm's documentation example" 2013-04-26 15:08:40 +00:00
Matt Walker
de336c6dd7 HTMLTextAreaField: Allow sizes to be overridden by child classes
Change-Id: I51e8bcba95c7b555f072329b01c6577115f246b3
2013-04-23 07:03:26 +00:00
Matt Walker
029d1bea36 HTMLForms: Support non submit buttons
There is now a new generic HTMLButtonField class which does
not need to be a submit button.

Change-Id: I451a952bba0c7339b5337e5201417beaee3f16fd
2013-04-23 06:52:52 +00:00
Alexandre Emsenhuber
c867664fe8 Fix HTMLForm's documentation example
- suppressReset() is useless since it's disabled by default now
- displayForm() requires an argument

Change-Id: I1125460611e74a3812784954a935fab612a7881c
2013-04-22 20:20:41 +02:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
Matt Walker
4e3e636a7c HTMLForm button behaviour modifications
- Buttons can now be marked disabled and they will not be clickable.
- The default submit button may now be opted out of.

Change-Id: I8293a3c09da51152bfc7f6f6951416c71ce0bb38
2013-04-04 09:09:34 +02:00
S Page
c86c699c6a Fix errors reported by phpcs in includes/HTMLForm.php
I set property "$typeMappings" to private (no clients outside this class
in our codebase).

I removed property $jsAdded, it is unused in this class and throughout
the codebase and seems a leftover from 2008.
Special:Preferences still works with this change.

Change-Id: Id5668141835e22e3e1b043109e50d73ccd6b1229
2013-03-28 08:44:04 +00:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Matt Walker
885a70945d Add ID to Nested Fieldsets
I'd rather just get rid of fieldsets when using the div output
format, but since I can't do that; at least give me the option
to style everything -- all the way down :)

Change-Id: Id95b1d98aa6ac11c5030d1ac96d05d6b60b7077e
2013-03-05 15:27:33 -08:00
Kaldari
043b6b32f6 Adding new subclass to HTMLForm for constructing a checkbox matrix
Also adding corresponding support for using them within preferences

Change-Id: Ie6e77dfd8edaff212655d0be1d048a10eeba341f
2013-02-27 11:56:31 -08:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
Santhosh Thottingal
8cc0fbb52d Allow preferences that need not be rendered in Special:Preferences
Extensions can use their own interface for user preferences, with the
help of the action=options API.

For example, Universal Language Selector has a different UI to
allow anonymous and logged in users to set language related preferences.

Validation for the preference values is up to the extensions.

Change-Id: I18a5ffb5cc202c59ba76b86cfb63e49010cc1881
2013-01-07 14:07:43 +01:00
IAlex
408a3df1dc Merge "Remove unused variables." 2012-10-09 10:23:38 +00:00
Siebrand Mazeland
632ce2a8fd Remove unused variables.
Change-Id: I4b76cbbca22555eacb8ef4de58993b485f7cdd18
2012-10-09 09:43:14 +00:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Siebrand Mazeland
b345869770 Prevent Call to a member function msg() on a non-object
- Added HTMLFormField::msg() to check whether $this->mParent->msg()
  can be called and otherwise use wfMessage()
- Made Licenses::msg() inline to prevent conflict with HTMLFormField::msg()

Change-Id: I7fa95e1d61ac4128d1d4d5f091c39bcbc8ecc651
2012-08-24 11:47:25 +02:00
Alexandre Emsenhuber
6567a953c8 Use local context to get messages
Change-Id: Ia615d3cf07bafd324b09bc6c8b0614fadbdc06d4
2012-08-21 22:11:18 +02:00
Siebrand Mazeland
6fe1f0509b Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: Ib15e670badd3f6aecae8b60e2f9129a31341ce16
2012-08-21 18:38:44 +02:00
Alexandre Emsenhuber
b34ac08369 Fix double escaping of fieldset's legend in HTMLForm.
The message is fetched using Message::escaped() but is
later passed to Xml::element() (from Xml::fieldset() call
HTMLForm::wrapForm()) which means it is double escaped.

Change-Id: I7154b3b26cc46759c184bdf9059d82470e2ab836
2012-08-20 16:54:11 +02:00
robin
e5abc04c03 Add 'list' to allowed input attributes in HTMLForm
Add 'list' (new in HTML5 as part of datalist) to the allowed input attributes in HTMLForm.
Also move maxlength into the general foreach.

Change-Id: I2ba61b0cc1b9f8b3db6c419efb5cbadfde594699
2012-08-18 03:32:51 +02:00
jeroendedauw
06db921d75 Improve handling of the required argument in HTMLForm field definitions
array( 'required' => false ) will now result in the field not being required rather then the unexpected opossite.

And this is now possible (without doing some extra if)

array( 'required' => getSomeBoolean() )

Change-Id: I1fc22b16ab1fa17111c48aa664aaf47de5f7075a
2012-08-12 00:26:17 +02:00
Antoine Musso
e684be51f4 link to HTMLForm doc on the wiki
URL provided by Clément Dietschy.

Change-Id: Ibea0266618c09b2dfbac5c356beba93dd8bebba2
2012-08-03 10:29:19 +00:00
Antoine Musso
5e8e2d76fe HTMLForm mutators can now be chained
This make HTMLForm mutator to return $this for easy method chaining such
as:

	form = new HTMLForm( $someFields );
	$form->setMethod( 'get' )
		 ->setWrapperLegendMsg( 'message-key' )
		 ->suppressReset()
		 ->prepareForm()
		 ->displayForm();

prepareForm()->displayForm(); should be at the very end apparently
though it is not enforced by the object.

Change-Id: Iebaa83a1da3c89e5ab729a889e54844535619d54
2012-08-02 19:15:42 +01:00
Antoine Musso
ef9534313e prevents some doxygen warnings
This patch fix misc issues reported by doxygen. Nothing fancy.

Change-Id: I98edc8c877019f1dc4a82a37bca518df2eb904fc
2012-07-15 22:32:48 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Reedy
0597984bd8 Fixup some wrong documentation
Don't try and return the result of void functions

Change-Id: I7a4db738b3e3052aebcf43742d31753f8cc1f47a
2012-06-15 15:05:49 +01:00
Werdna
ebf2912801 Merge "Adds support to HTMLForm for rendering form fields wrapped in divs or just plain old (mostly) raw form fields." 2012-06-06 05:30:28 +00:00
Max Semenik
4d3620a08d HTMLForm: throw a warning when no callback is set
Change-Id: Ied019afaf607c4b5967989fcb53945a116eeaed6
2012-05-22 19:11:13 +04:00
awjrichards
15599d3d39 Adds support to HTMLForm for rendering form fields wrapped in divs
or just plain old (mostly) raw form fields.

Also fixes minor code style issues

Change-Id: Ia9510d6960f2adb17c1bb19e378763a60169dee6
2012-05-19 07:06:15 -07:00