Commit graph

116 commits

Author SHA1 Message Date
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/&nbsp;/\&#160;/g;s/&mdash;/―/g;s/&bull;/•/g;s/&aacute;/á/g;s/&acute;/´/g;s/&agrave;/à/g;s/&alpha;/α/g;s/&auml;/ä/g;s/&ccedil;/ç/g;s/&copy;/©/g;s/&darr;/↓/g;s/&deg;/°/g;s/&eacute;/é/g;s/&ecirc;/ê/g;s/&euml;/ë/g;s/&egrave;/è/g;s/&euro;/€/g;s/&harr;//g;s/&hellip;/…/g;s/&iacute;/í/g;s/&igrave;/ì/g;s/&larr;/←/g;s/&ldquo;/“/g;s/&middot;/·/g;s/&minus;/−/g;s/&ndash;/–/g;s/&oacute;/ó/g;s/&ocirc;/ô/g;s/&oelig;/œ/g;s/&ograve;/ò/g;s/&otilde;/õ/g;s/&ouml;/ö/g;s/&pound;/£/g;s/&prime;/′/g;s/&Prime;/″/g;s/&raquo;/»/g;s/&rarr;/→/g;s/&rdquo;/”/g;s/&Sigma;/Σ/g;s/&times;/×/g;s/&uacute;/ú/g;s/&uarr;/↑/g;s/&uuml;/ü/g;s/&yen;/¥/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 &nbsp 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