Daniel Friesen
391736c081
Use IContextSource instead of RequestContext inside type hints and instanceof checks. All we need is something that implements IContextSource and it's possible we may want to implement types of RequestContext that don't directly extend RequestContext but are perfectly valid to be passed to classes.
2011-09-15 15:19:49 +00:00
Roan Kattouw
b295b9e1e1
Followup r92155, move preferences-specific code introduced in HTMLForm to Preferences.php. Dropping $displayTitle and replacing it with something else is OK since $displayTitle was introduced as a hack for the preferences form anyway
2011-08-25 09:44:20 +00:00
Sam Reed
5e60c1af35
Revert r95408, breaks preferences
2011-08-24 19:48:59 +00:00
Sam Reed
860b602f5f
Revert changes to HTMLForm from r92155
2011-08-24 18:11:55 +00:00
John Du Hart
d17077d6fc
(bug 30335) Fix for HTMLForms using GET breaking when non-friendly URLs are used
2011-08-23 19:56:15 +00:00
Chad Horohoe
22749f36cd
w/s fix for r92882
2011-08-02 23:16:44 +00:00
Aaron Schulz
cf93004435
Document parameter in loadInputFromParameters
2011-07-22 19:44:48 +00:00
Sam Reed
ead9055a62
Update code comments that point to 1.18 to point to 1.19
2011-07-18 23:01:08 +00:00
Leo Koppelkamm
0cfb2628da
Restructure tab code of mediawiki.special.preferences.js . * 10 levels of indent, really? * Follow up r91869: Instead of setting the title, and later parsing it out and setting id from it, just set the id directly. * Hashes are now in the form #prefsection-personal. This means that they now work in browser with deactivated JS as well.
2011-07-14 12:49:39 +00:00
Leo Koppelkamm
0482a70d82
use tab name, not tab index for anchors on Special:Preferences. Bug 29672 . Patch by Jarry1250. Ping r91757
2011-07-11 09:54:40 +00:00
Robin Pepermans
3dbd62f290
Bug 29792: notice undefined index 'other' due to my commit r91803
2011-07-09 21:13:57 +00:00
Robin Pepermans
a3630dcbdd
Allow the 'other' parameter for HTMLForm selectorother: it is used in SpecialBlock.php::getFormFields() (and maybe in more files)
2011-07-09 19:33:58 +00:00
Leo Koppelkamm
42d5c3f64d
HTMLForm: Add option to output a title for a fieldset & activate it for Special:Pref. Preliminary work for Bug 29672
2011-07-08 21:12:10 +00:00
Alexandre Emsenhuber
8635d5cb65
Changed calls to Linker::tooltipAndAccesskeyAttribs() to be static and fixed casing in method's name
2011-07-04 08:28:27 +00:00
Bryan Tong Minh
707a2fa8fe
Follow-up r80988: fix function documentation
2011-06-30 17:35:37 +00:00
Happy-melon
d16f4b8850
(bug 29511) block dropdown reasons should be in wiki content language.
2011-06-27 18:05:09 +00:00
Sam Reed
fc35a42ffd
Fix more __get() calls on RequestContext
2011-06-17 13:27:39 +00:00
Sam Reed
4c29198850
And some more....
2011-05-28 17:51:33 +00:00
Mark A. Hershberger
0a49fd69b0
Misc EOL w/s and spaces-instead-of-tabs fixes. One day I'll get around to nagging people for this stuff, but for now, I'll JFDI myself.
2011-05-25 15:39:47 +00:00
Alexandre Emsenhuber
92dfa87364
Simplify message existence checks by using wfMessage() instead of wfEmptyMsg()
2011-05-24 17:28:21 +00:00
Siebrand Mazeland
75c6696aa8
Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely.
2011-05-17 22:03:20 +00:00
Sam Reed
5db2450c55
Documentation
...
Remove unused variables
2011-05-04 21:23:25 +00:00
Siebrand Mazeland
02e44a71b0
Revert r86872: Breaks LiquidThreads page moves with the below failure. Threads are lost and nowhere to be found any more.
...
[25-Apr-2011 18:12:45] /wiki/Special:MoveThread/Thread:User_talk:Siebrand/test/One_new_message: Exception: MWNamespace::getTalk does not make any sense for given namespace -1
#0 /www/w/includes/Namespace.php(81): MWNamespace::isMethodValidFor(-1, 'MWNamespace::ge...')
#1 /www/w/includes/WatchedItem.php(73): MWNamespace::getTalk(-1)
#2 /www/w/includes/User.php(2304): WatchedItem->addWatch()
#3 /www/w/includes/actions/WatchAction.php(53): User->addWatch(Object(Title))
#4 /www/w/includes/Action.php(376): WatchAction->onView()
#5 /www/w/extensions/LiquidThreads/classes/Thread.php(115): FormlessAction->execute()
#6 /www/w/extensions/LiquidThreads/classes/Thread.php(435): Thread::create(Object(Article), Object(Article), NULL, 1, 'One new message')
#7 /www/w/extensions/LiquidThreads/classes/Thread.php(414): Thread->leaveTrace('move test', Object(Title), Object(Title))
#8 /www/w/extensions/LiquidThreads/pages/SpecialMoveThread.php(107): Thread->moveToPage(Object(Title), 'move test', true)
#9 [internal function]: SpecialMoveThread->trySubmit(Array)
#10 /www/w/includes/HTMLForm.php(279): call_user_func(Array, Array)
#11 /www/w/includes/HTMLForm.php(228): HTMLForm->trySubmit()
#12 /www/w/includes/HTMLForm.php(242): HTMLForm->tryAuthorizedSubmit()
#13 /www/w/extensions/LiquidThreads/pages/ThreadActionPage.php(37): HTMLForm->show()
#14 /www/w/includes/SpecialPageFactory.php(459): ThreadActionPage->execute('Thread:User_tal...')
#15 /www/w/includes/Wiki.php(252): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#16 /www/w/includes/Wiki.php(98): MediaWiki->handleSpecialCases()
#17 /www/w/index.php(145): MediaWiki->performRequestForTitle(NULL)
#18 {main}
2011-04-25 18:20:53 +00:00
Happy-melon
70bdc008c4
Implement an interface and abstract class to hold the widely-reused get(Request|User|Title|Lang|Skin|Output) accessors for objects acting as a context source. Article is rather messier because both getTitle() and getUser() are in use for other things, and Article::$mTitle is in extremely wide use both within Article.php and outside.
2011-04-25 17:37:43 +00:00
Happy-melon
d166859bc4
Some type-hinting and documentation in HTMLForm.php
2011-04-23 21:27:24 +00:00
Happy-melon
58caa451fa
Look mum, no globals! Implement a RequestContext for HTMLForm, passed in the constructor. Currently this is optional with B/C; at a later date it should be made compulsory. Doing this removes the need to call $form->setTitle() on every single use; only when you want to set the title to something other than the page context title. Implemented the new syntax in a sample of forms. Also fix a few minor errors in HTMLForm.php that my IDE complained about.
2011-04-13 16:51:22 +00:00
Happy-melon
ff194ef5b4
Follow-up r85025: fix the you're-trying-to-block-yourself-you-twit warning, and make it an actual checkbox confirmation. Also use said confirmation for reblocks, and HideUser (bug 18678). Mark a static function from HTMLForm which is called from SpecialBlock as explicitly public.
2011-04-01 23:13:15 +00:00
Happy-melon
1f874c59d2
Follow-up r83907: abstract the flatlist mode into a descriptor option, and make it so the label does not linewrap away from the checkbox.
2011-03-27 22:45:32 +00:00
Happy-melon
03cdc155b7
Topple the last bastion of global-function-based special pages. Also fix HTMLCheckField to work with GET forms.
2011-03-26 19:18:39 +00:00
Happy-melon
b1dd860b95
Refactor the get-legend-for-section-fieldset logic out into its own function so it can be overridden.
2011-03-24 22:46:07 +00:00
Happy-melon
6bedff7ac7
Some tweaks to HTMLMultiSelect form to make it play nicely with GET forms, and also to allow a 'flat list' of options
2011-03-14 15:50:26 +00:00
Niklas Laxström
7e9149bb02
Follow-up r83809 r83810: improved documentation
2011-03-13 10:02:56 +00:00
Niklas Laxström
5b0cc178cb
HTMLForm:
...
* Allow field validators to return multiple errors
* Allow field validators to return Message objects
* Add a class for fields for invalid input
* Style invalid <input> fields with red border color
Done with http://www.mediawiki.org/wiki/StyleGuide/Forms in mind
2011-03-13 09:51:47 +00:00
Happy-melon
3d161feebf
Follow-up r83755: @deprecated @since is wrong, doesn't have the expected semantic meaning.
2011-03-12 18:14:33 +00:00
Happy-melon
bbf16f8c3a
Follow-up r83298: keep the two elements of the message separate in an array in HTMLSelectAndOtherField::loadDataFromRequest(), fixes various bugs with validation, defaults, and normalisation.
2011-03-12 11:08:20 +00:00
Antoine Musso
8a3dcccbda
Remove second parameters from wfEmptyMsg() calls
...
The second parameter was removed in r64178 and is now useless.
There is probably no need to backport this in 1.17.
2011-03-07 17:10:22 +00:00
Happy-melon
968340d310
Follow-up r83280; looks like I accidentally deprecated a piece of legacy JS :D
2011-03-05 17:06:42 +00:00
Happy-melon
b61a470845
HTMLFormField class to build a select-dropdown-with-additional-text-field structure, with the select options maybe parsed from a system message as is done for the protect, block, delete, fileupload, etc, dialogues. Serves as a replacement vector for Xml::listDropDown().
2011-03-05 16:51:13 +00:00
Happy-melon
1c866270b3
Follow-up r83183, r83202:
...
* Update SpecialCheckUser.php to new location of IP functions
* Spin out the 'hide-other-field-if-select-box-not-on-other' function as one which should apply to all such fields, especially those created via HTMLForm. SpecialBlockip and SpecialGlobalBlock should ultimately be converted to use HTMLForm anyway.
2011-03-05 12:48:32 +00:00
Happy-melon
ef6041d750
revert r82283, loads of unrelated changes
2011-02-16 19:51:25 +00:00
Happy-melon
d64cd26a7c
Create a user.groups module in ResourceLoader, which bundles a CSS and JS page for each usergroup the user is a member of (MediaWiki:Sysop.js, MediaWiki:Autoconfirmed.css, etc). Groups '*' and 'user' are not included.
2011-02-16 19:49:37 +00:00
Bryan Tong Minh
5622530d07
Follow-up r77640: Check whether there are errors before asking Status to transform them into wikitext.
2011-02-02 15:44:42 +00:00
Bryan Tong Minh
ade2b6e3a5
(bug 26929) Introduced the edittools-upload message, which will be inserted under the upload form instead of edittools if available
2011-01-27 20:58:37 +00:00
Bryan Tong Minh
20b93f7922
HTMLForm: All section headers and footers. Added an optional second $section parameter to addHeaderText and addFooterText.
2011-01-25 20:56:56 +00:00
Antoine Musso
83848f26d9
bug 10158 : do not mention allowing others to contact you if $wgEnableUserEmail=false
...
This required to tweak HTMLForm to support an array of message keys
for help message. I could reuse help-message but since this helper
also supports array, I created an additional helper for array of
messages.
To test use variations of $wgEnableUserEmail and $wgEmailConfirmToEdit.
Path adapted from jopiswezggzmw at mailinator dot com
2011-01-14 16:53:36 +00:00
Tim Starling
ccfe5ad97b
Fix for bug 26561: clickjacking attacks. See the bug report for full documentation.
2011-01-04 06:12:33 +00:00
Happy-melon
e9740b2525
Nicer way of doing r78566, and also one which won't incur Tim's wrath... :D
2010-12-18 19:08:22 +00:00
Happy-melon
0e79acf6a9
r52070 breaks the use of optgroups etc: array(...) is cast to 'Array'. Need to only cast integers to strings.
2010-12-18 16:25:14 +00:00
Happy-melon
9dfd61d632
Follow-up r78445: don't spam a useless edit token into the URL for GET requests.
2010-12-15 21:37:50 +00:00
Happy-melon
f301f15827
Clean up the running mess that is r64866, r65040, and then r67277. Implement and document consistent behaviour for all types of fields: if the 'name' parameter is specified, use it exactly as is, otherwise use "wp{$fieldname}". For hidden fields added with addHiddenField(), continue to use either $attrib['name'] or $name, both unaltered.
2010-12-15 21:14:36 +00:00
Happy-melon
ca0e1a0ff0
Follow-up r78445: validation errors would never be shown on a GET form
2010-12-15 20:10:16 +00:00
Happy-melon
7d41eadb8e
Allow HTMLForms to be submitted by GET requests.
2010-12-15 19:33:03 +00:00
Happy-melon
34d0138865
Better regexes for r78246.
2010-12-15 13:33:47 +00:00
Neil Kandalgaonkar
4c6ddfd55e
refactored HTMLForm show() into three methods, in case you want to process a form in some way separate from showing it.
2010-12-15 01:17:28 +00:00
Happy-melon
c3889287f2
Follow-up to r64866: follow the HTML5 spec when validating floats and ints, and support 'required' attribute universally (apart from type=hidden).
2010-12-12 15:32:29 +00:00
Alexandre Emsenhuber
9e25ce6e0d
Allow the submit callback function to return a Status object (will use this later for other forms)
2010-12-03 11:29:55 +00:00
Bryan Tong Minh
5971e048c0
Fix fail from r57867: tooltip param was never used in HTMLForm
2010-11-11 20:06:22 +00:00
Sam Reed
6b3b915353
Big attack on unused variables...
2010-10-14 20:53:04 +00:00
Platonides
0c52065dac
Follow-up r72349.
...
Remove unused globals $wgStylePath, $wgStyleVersion, $wgUser and the no longer used $wgJQueryOnEveryPage.
2010-09-04 13:27:12 +00:00
Roan Kattouw
32377424b9
Merging resourceloader branch into trunk. Full documentation is at http://www.mediawiki.org/wiki/ResourceLoader and a general overview has been posted on wikitech-li < http://lists.wikimedia.org/pipermail/wikitech-l/2010-September/049253.html >. One important change is that all JS is now loaded at the bottom, so any scripts assuming things from wikibits or whatever are present will fail.
2010-09-04 04:00:09 +00:00
Sam Reed
cc218ccc8f
Remove some more unused variables
2010-08-13 11:43:01 +00:00
Andrew Garrett
665b54cc1d
Remove double-wrapping in trs
2010-07-02 21:40:47 +00:00
Andrew Garrett
351e25c211
Add vertical-label option to HTMLForm, for CommunityHiring
2010-07-02 21:20:54 +00:00
Aryeh Gregor
74a21f3bd1
Remove most named character references from output
...
Recommit of r66254 to trunk. This was just
find extensions phase3 -iname '*.php' \! -iname '*.i18n.php' \! -iname 'Messages*.php' \! -iname '*_Messages.php' -exec sed -i 's/ /\ /g;s/—/―/g;s/•/•/g;s/á/á/g;s/´/´/g;s/à/à/g;s/α/α/g;s/ä/ä/g;s/ç/ç/g;s/©/©/g;s/↓/↓/g;s/°/°/g;s/é/é/g;s/ê/ê/g;s/ë/ë/g;s/è/è/g;s/€/€/g;s/↔//g;s/…/…/g;s/í/í/g;s/ì/ì/g;s/←/←/g;s/“/“/g;s/·/·/g;s/−/−/g;s/–/–/g;s/ó/ó/g;s/ô/ô/g;s/œ/œ/g;s/ò/ò/g;s/õ/õ/g;s/ö/ö/g;s/£/£/g;s/′/′/g;s/″/″/g;s/»/»/g;s/→/→/g;s/”/”/g;s/Σ/Σ/g;s/×/×/g;s/ú/ú/g;s/↑/↑/g;s/ü/ü/g;s/¥/¥/g' {} +
followed by reading over every single line of the resulting diff and
fixing a whole bunch of false positives. The reason for this change is
given in <http://lists.wikimedia.org/pipermail/wikitech-l/2010-April/047617.html >.
I cleared it with Tim and Brion on IRC before committing. It might
cause a few problems, but I tried to be careful; please report any
issues.
I skipped all messages files. I plan to make a follow-up commit that
alters wfMsgExt() with 'escapenoentities' to sanitize all the entities.
That way, the only messages that will be problems will be ones that
output raw HTML, and we want to get rid of those anyway.
This should get rid of all named entities everywhere except messages. I
skipped a few things like   that I noticed in manual inspection,
because they weren't well-formed XML anyway.
Also, to everyone who uses non-breaking spaces when they could use a
normal space, or nothing at all, or CSS padding: I still hate you. Die.
2010-05-30 17:33:59 +00:00
Siebrand Mazeland
e0a4a54ca1
Ran stylize.php, removed trailing whitespace, updated indentation and code formatting.
2010-05-30 12:44:17 +00:00
Alexandre Emsenhuber
beef1e0d5e
removed unused variable
2010-05-24 12:52:26 +00:00
Andrew Garrett
2b2bb7c61c
Some weird people are using HTMLForm without a submission callback.
2010-05-05 02:42:03 +00:00
Andrew Garrett
9610b8d444
HTMLForm: Throw exceptions in some circumstances
2010-05-03 09:10:50 +00:00
Alexandre Emsenhuber
b90d647487
Per report on translatewiki: "namespaces to search" user option always displays all fields unchecked
2010-04-18 11:58:39 +00:00
Happy-melon
861d1b81b1
From r64866, more consistent behaviour of hidden field names. May affect r65029.
2010-04-14 21:42:37 +00:00
Happy-melon
2a28ffda5e
Follow-up to r64866 - add message, and apply the same validation to TextareaField as well.
2010-04-10 21:10:22 +00:00
Happy-melon
317836768b
Improvements and fixes to HTMLForm:
...
* allow css classes to be specified in form descriptors
* Don't overwrite $field['name'] if it's set
* Allow IDs on hidden fields
* Enforce 'required' validation on Text fields
* Fix type validation on Int fields to correctly handle numbers larger than PHP_MAX_INT or with leading zeroes (eg phone numbers on 32 bit systems)
* Fix weak-typing error in MultiSelect field
* Formatting and doc fixes
2010-04-10 12:03:30 +00:00
Roan Kattouw
f728ddc6d2
(bug 19627) Fix regression from r57867 where HTMLForm would output <element classes="foo bar"> rather than <element class="foo bar">
2010-03-15 08:11:19 +00:00
Happy-melon
eb002b00c1
HTMLSubmitField is more useful as an inline button than an alias for HTMLForm::addButton().
2010-03-13 15:33:18 +00:00
Raimond Spekking
18ed54d077
Tweak 'HMTL 5' -> 'HTML5' per suggestion on translatewiki: http://translatewiki.net/wiki/Thread:Support/HTML5
...
See http://en.wikipedia.org/wiki/HTML5 too.
2009-12-30 07:08:52 +00:00
Tim Starling
7688101426
Removed JS2 work (has been moved to the js2-work branch). Has been lightly tested, should mostly work. Some of the more complicated associated changes are listed below.
...
* Reverted HttpFunctions.php to r45549 and renamed wgSyncHTTPTimeout back to wgHTTPTimeout
* Edited out the asynchronous features from UploadFromUrl. Made fetchFile() use the curlCopy() function from new-upload r47811 instead of Http::doDownload(). Wrote my own URL validity check to avoid having to use either of the two buggy precedents.
* Removed UploadFromChunk
* Removed chunk upload and background status from ApiUpload.php
* Reverted r54669, use of addScriptClass()
* Left getHeadScripts() in its current location (OutputPage) instead of moving it back to SkinTemplate, just added wikibits.js to it to replace the removed addCoreScripts2Top()
2009-11-26 12:00:36 +00:00
Aryeh Gregor
38331bbce0
Avoid pointless $wgHtml5 checks
...
Html::rawElement() should strip out any invalid attributes if $wgHtml5
is off. This commit should introduce no functional change. Any future
problems with attributes being added incorrectly should be fixed in
Html.php, not callers.
Follow-up to r57096.
2009-11-19 01:24:58 +00:00
Andrew Garrett
45d31742e2
Fix incompatibility with PHP<5.2
2009-11-16 16:21:11 +00:00
Siebrand Mazeland
e8a65f9e25
Update break notation to self enclosed and properly spaced
2009-11-14 20:59:15 +00:00
Bryan Tong Minh
01bf3fccd2
Parse the edittools message so that it actually works (follow up to r57868).
...
Message is now also customizable.
2009-10-19 19:55:54 +00:00
Bryan Tong Minh
918171cef4
Update HTMLForm for upcoming Special:Upload rewrite.
...
* Add support for edittools
* Add support for multipart/form-data
* Set id for wpEditToken
* Add support for tooltip and accesskey
* Allow setting a name for the submit button
* Give sections an id
2009-10-18 19:29:35 +00:00
Bryan Tong Minh
92c38323e0
* Add file and textarea support to HTMLForm.
...
* Move HTML label generation to separate function, because it needs to be overridden for SpecialUpload
2009-10-09 14:22:37 +00:00
Happy-melon
7c63edecce
Recommit r56947, partially overwritten in r57024.
2009-09-30 09:46:48 +00:00
Happy-melon
0e436d09c3
Recommit some of the 'backend' stuff from the Login branch, after talking with Brion:
...
* ExternalUser::getLocalUser() from r56683
* Documentation and style tweaks for HTMLForm from r56682
* HTMLForm::add{HiddenField|(Pre|Post|Header)Text|Button}() functions, from 56782 and r56896.
Frontend stuff will wait until after 1.16 is branched.
2009-09-28 19:04:10 +00:00
Happy-melon
6fce8771f7
Fix bug in HTMLForm where password fields only got the type="password" attribute if $wgHtml5 = true. Prompted by r56937.
2009-09-26 11:20:25 +00:00
Brion Vibber
0d1d984313
Revert broken rewrite of login system; totally broken.
...
* Login doesn't attach to session properly, so can't stay logged in!
* Password field shown in plaintext!
If it just DOESN'T WORK please keep it on a work branch, don't put it in trunk!
Reverted:
r56682
r56683
r56684
r56686
r56688
r56696
r56699
r56702
r56703
r56704
r56782
r56896
2009-09-26 00:49:32 +00:00
Happy-melon
e5a74e5ff7
Improve HTMLForm's support for adding content in and around the form, to improve versatility. Groundwork for being able to validate, filter and submit the CreateAccount input via HTMLForm::trySubmit(), which will give extensions huge flexibility to play with the form input.
...
Also change the wrapping on both forms to use a <fieldset>, which is visually more consistent with the other forms we have floating around the site. Add visualClear to all HTMLForm forms, and remove all the redundant CSS for the login form, quite a bit of which has been dead for a while.
2009-09-24 21:25:33 +00:00
Happy-melon
f4dd596f5c
Allow extra buttons and hidden fields to be included in HTMLForm. Accessible either before Form construction (as HTMLFormField subclasses that can be passed in the Descriptor array as for other input) or after (as methods addHiddenField() and addButton(), respectively).
2009-09-22 20:05:28 +00:00
Happy-melon
7732401c9b
Document and tidy HTMLForm.php. :P
2009-09-20 18:50:38 +00:00
Alexandre Emsenhuber
b5311badc4
* (bug 20556) Stub threshold's "other" <input> in Special:Preferences now has a correct type="text" parameter
...
* also fix a bug in the detection if the "other" value is passed in the predefined options, remember: 0 == 'other' returns true (thank you, PHP, really)
2009-09-11 15:53:48 +00:00
Aryeh Gregor
f03c53b8a7
Fix silly <table class=''>
2009-09-07 15:25:22 +00:00
Aryeh Gregor
650e0d72ac
Don't output for= that doesn't point anywhere
...
This fixes an HTML validity issue with HTMLForm.
2009-09-07 01:48:06 +00:00
Aryeh Gregor
da497558a0
Convert HTMLForm to use more Html::*
2009-09-07 01:47:45 +00:00
Aryeh Gregor
a20dd0e6ab
Remove unneeded class left by r55879
2009-09-06 15:41:24 +00:00
Aryeh Gregor
1ef5b8c191
Reimplement r55876 properly
2009-09-06 15:07:29 +00:00
Happy-melon
884b94f43b
Allow password fields to be served by HTMLForm.
2009-09-06 14:32:03 +00:00
Aryeh Gregor
5e72d3501e
Emit CDATA more intelligently
...
This fixes some possible XML invalidity from r54767: CDATA stuff was
being added only if $wgHtml5 was false, instead of whenever
$wgWellFormedXml is true. Also, it uses CDATA for script as well as
style, but in both cases only uses it if there's a & or < somewhere.
2009-08-23 21:06:54 +00:00
Niklas Laxström
aa58f44af4
Support script loader
2009-08-09 16:20:14 +00:00
Aryeh Gregor
e0834ecdbf
Start using some HTML 5 form features
...
autofocus attribute added in some places; this looks like it's respected
by both recent Opera and recent WebKit. Its function is
self-explanatory. :) I used this in a few obvious places like
Special:UserLogin and Special:ResetPass to focus the first field in the
form. Could be used in other places too: Special:Search, etc.
required attribute added in some places. This is only supported in
recent Opera at the moment. Also self-explanatory: it won't allow form
submission if the field is empty.
For stuff using HTMLForm (i.e., Special:Preferences), validation will be
done for integers and floats. Browsers that support this (recent Opera)
will not allow non-integers to be submitted for integer fields, will not
allow non-floating-point values to be submitted for float fields, and
will enforce any min/max values specified. Opera also gives little up
and down arrows to allow the user to increment/decrement the value in
addition to letting them edit the field as text.
For HTMLForm and account creation, the email input type is used for
e-mails. This enforces a sane set of values for e-mails (alphanumerics
plus some ASCII punctuation, with an @ in it). Again, this is supported
only by recent Opera (yay Opera!). Note that this is actually more
restrictive than what we currently check for on the server side; it
might be sane to tighten up our server-side checks to forbid e-mail
addresses that HTML 5 forbids.
In all cases, the extra features aren't added if $wgHtml5 is false, and
will be ignored by non-supporting browsers.
The major room for further improvement here is use of the pattern
attribute. We can have the client refuse to submit the form unless it
matches a regex! The HTML 5 spec says that if a title attribute is
provided, it should be a message that explains what the valid values
are and browsers should provide it to the user if the regex doesn't
match, so it's not a usability problem. I didn't bother adding that
anywhere at this point because it would require adding new messages, but
it should be easy to do. Note of course that HTMLForm should be updated
to verify that pattern matches on the server side as well -- this way we
have a clean, unified way of ensuring that our client and server checks
are the same.
2009-08-07 03:32:20 +00:00
Andrew Garrett
20e72c2634
Fix regression in r53316, some more intelligent handling.
2009-07-29 16:20:10 +00:00