Commit graph

1463 commits

Author SHA1 Message Date
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
jenkins-bot
24ebca2251 Merge "Use HTML::hidden to create input fields" 2017-08-07 10:07:07 +00:00
Max Semenik
fd6e9ef2d4 Human-readable section ID support
It adds the ability to replace the current section ID escaping
schema (.C0.DE) with a HTML5-compliant escaping schema that is
displayed as Unicode in many modern browsers.

See the linked bug for discussion of various options that were
considered before the implementation. A few remarks:
* Because Sanitizer::escapeId() is used in a bunch of places without
  escaping, I'm deprecating it without altering its behavior.
* The bug described in comments for Parser::guessLegacySectionNameFromWikiText()
  is still there in some Edge versions that display mojibake.

Bug: T152540
Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
2017-08-01 20:32:20 -07:00
Bartosz Dziewoński
8c1a1a62a1 Avoid duplicate accesskey hints on OOUI widgets
Values returned by `Linker::tooltipAndAccesskeyAttribs()` and
`Linker::titleAttrib( ..., 'withaccess' )` include an accesskey
hint in the title text. This is unnecessary when used for OOjs UI
widgets, since after the changes from T168408 they display an
accesskey hint automatically.

Also fixed some other accesskey bugs in HTMLForm which probably
no one ever ran into.

Bug: T168408
Change-Id: I63285b5bce3341875a6d82eba059623bf105ca62
2017-08-01 20:59:13 +00:00
WMDE-Fisch
ff2f868a92 Use HTML::hidden to create input fields
Also add line break to comment added some patch before.

Change-Id: I9bd66b8444c069b4055fc5c3396256b688b78561
2017-07-25 11:46:25 +02:00
WMDE-Fisch
223dee0752 Add doc for showEditTools method
Change-Id: Ic6931ed6cdecb7b42e2c47b7c8b34b6d1d23be13
2017-07-24 19:10:26 +02:00
Kunal Mehta
d1cf48a397 build: Update mediawiki/mediawiki-codesniffer to 0.10.1
And auto-fix all errors.

The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.

Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
2017-07-22 18:24:09 -07:00
Kunal Mehta
4fa0c27cc8 Avoid globals in EditPage::__construct()
Change-Id: Icb1d1042f4bb5e4397c49f20ce26ab9c73e9d0d1
2017-07-17 14:07:45 -07:00
WMDE-Fisch
f50cb9abae Add tracking for resolved conflicts
Bug: T167863
Change-Id: I48bbfc7216d1f726dbcec3ae337466bbf8b2a486
2017-06-28 13:51:58 +00:00
Bartosz Dziewoński
3a6b810dd4 EditPage: Fix 'id' attributes on buttons in non-OOUI mode
Follow-up to ce2290e481.
I really did not think that change through.

Bug: T167390
Change-Id: I6d683cafe02137800925507d5e00663756002296
2017-06-08 19:08:59 +02:00
Bartosz Dziewoński
dd362c923d EditPage: Give edit summary field's 'tabindex' as a number
There's a bug in OOjs UI that causes the string value to be ignored
after the input is infused (e.g. by the mediawiki.action.edit script).

Bug: T167070
Change-Id: Ibeefc8327b462552c67459aac2c75cca9b1f4739
2017-06-06 00:30:49 +02:00
Bartosz Dziewoński
ce2290e481 EditPage: Restore the old 'id' attributes in OOUI mode
For compatibility with old scripts and extensions, we want the legacy
'id' on the `<input>` elements. There is really no good justification
for breaking all of them when we can easily support it.

The actual `<input>` elements have their ids back: 'wpSummary',
'wpSave', 'wpPreview', 'wpDiff', 'wpMinoredit', 'wpWatchthis'.

The widgets (wrapped `<div>`s) now use ids with 'Widget' appended.

Bug: T165854
Change-Id: I4d23f57fd0cda4b8539ffb17a2a19ecd822e077a
2017-06-01 17:48:26 +02:00
Bartosz Dziewoński
9ebc94191a EditPage: Fix passing the save/publish button label to other messages
We were passing the message key, instead of the message text.
Follow-up to 44f5962313.

Bug: T166478
Change-Id: Iaf33b0e6fba71ebf1130fc067210ed49c1b06011
2017-05-29 20:56:05 +02:00
Bartosz Dziewoński
c94077e0e2 EditPage: Preserve &ooui=1 / &ooui=0 from URL after preview
Bug: T165237
Change-Id: Ia546159b45fabb1256f63f888412703ca3eba2e9
2017-05-15 20:33:37 +02:00
Fomafix
0927a5045d Clear postEdit cookie on server-side
* Load module 'mediawiki.action.view.postEdit' only when needed.
* Transfer message key via JavaScript config variable wgPostEdit.
* The response is maked as not-cachable to prevent that other users get the
  post edit message.

This change redefines the global JavaScript variable wgPostEdit from true
to a string and set it on server-side.

Bug: T164148
Change-Id: Id780bc280ce4a2fa4606141419932b7dcd45157b
2017-05-05 23:58:19 +00:00
Paladox
54c56da85a Fix php code style
Preparation change for updating mediawiki code sniffer to 0.8.0

Change-Id: Ib0b3fe4afea9096ffa3a1347b4f7e07d3398b0b2
2017-05-05 12:03:54 +00:00
James D. Forrester
44f5962313 EditPage: Vary 'save button' label for appropriate i18n
Change-Id: I0fd2995aa3178d383aa099cb0852336a1c67893d
2017-05-01 23:18:21 +00:00
James D. Forrester
14cffee7c1 mediawiki.toolbar: Emit deprecation warnings
Callers to the EditPageBeforeEditToolbar hook can now return false to
signal that the toolbar is over-written, in which case this old code
won't be called (so no deprecation warnings for users of WikiEditor,
CodeEditor, etc.).

Bug: T30856
Depends-On: I5e755ef5dffb843368563511044d3123f14dc4bc
Change-Id: I3bed70a20e4b94fe3d04a00925b8012312202574
2017-04-26 16:18:30 -07:00
jenkins-bot
143f36732f Merge "EditPage: Factor out getSaveButtonLabel method" 2017-04-26 13:15:56 +00:00
James D. Forrester
061ee63884 EditPage: Factor out getSaveButtonLabel method
Change-Id: I89a2e3b6b8d23b2fafa5eeec59d79e37f61edefd
2017-04-18 17:29:29 -07:00
jenkins-bot
ad68cd419a Merge "EditPage: Restore IE 6 compatibility for OOUI-style buttons" 2017-04-18 19:03:23 +00:00
Bartosz Dziewoński
0c3a2e2446 EditPage: Restore IE 6 compatibility for OOUI-style buttons
Follow-up to 97d7de0b84.

Bug: T163219
Change-Id: Ifb5145c631ce1a3aa7e51956fab3ec7da8b994d2
2017-04-18 11:50:53 -07:00
Bartosz Dziewoński
9cbf4bdcc9 EditPage: Restore ability to provide edit summary for OOUI-style input
The 'name' attribute was missing, so the field was not being submitted
with the form.

Change-Id: Ic7238b9bfe9ca254f844fb828cf09ecf44171461
2017-04-18 18:09:11 +00:00
Ed Sanders
093126b71e EditPage: Make input and button widgets infusable
This will allow gadget developers greater control, e.g. disabling.

Change-Id: I9a21cd2dd3fc7695fc09632b844cc1afd0db0355
2017-04-15 22:08:35 +00:00
Florian
97d7de0b84 Convert EditPage buttons, checkboxes and summary input to OOUI
Several methods now have a new implementation using OOjs UI widgets
(ButtonInputWidget/ButtonWidget, CheckboxInputWidget, TextInputWidget).
The existing (public) methods are unchanged. The OOjs UI version is
used by default.

Because this change can cause problems for extensions and on-wiki
scripts depending on the exact HTML, the old version is still available
and can be used by setting $wgOOUIEditPage = false; in LocalSettings.php.
This will be removed later and OOjs UI will become the only option.
To make testing easier, users can also force either mode by adding
&ooui=true or &ooui=false to the action=edit URL.

* EditPage::getSummaryInput() and EditPage::getSummaryInputOOUI()
* EditPage::getCheckboxes() and EditPage::getCheckboxesOOUI()
* EditPage::getCancelLink()
* EditPage::getEditButtons()

Bug: T111088
Co-Authored-By: Amir Sarabadani <ladsgroup@gmail.com>
Co-Authored-By: Florian Schmidt <florian.schmidt.welzow@t-online.de>
Change-Id: I25aa78ac59082789938ecfb5878eb16614392995
2017-04-12 01:35:24 +00:00
Ed Sanders
ec505eb254 EditPage: Fix typo in comment
Change-Id: I084933a733c704188217c1d306454d2fed08b59b
2017-04-09 18:03:32 +01:00
Brian Wolff
288512618e SECURITY: Escape wikitext content model/format in message
Escape wikitext in model= and format= url parameter to
edit page. This goes along with 1c788944 to help prevent
XSS for wikis with $wgRawHtml = true; set.

Bug: T156184
Change-Id: Ifcaa2ccf05a2a691d0b150e2f7e0e765db25fc7f
2017-04-06 13:42:58 -07:00
Fomafix
7a3418ae33 Use consistent spaces at start and end of comments
Change-Id: Idbb09b69aa1ef4e46433319aaea62f34f0dbc038
2017-03-30 22:06:40 +02:00
Bartosz Dziewoński
078dbb8e56 EditPage: Refactor getCheckboxes() to allow changing the format
getCheckboxes() directly generated the HTML for the
"This is a minor edit" and "Watch this page" checkboxes,
and allowed extensions to add more HTML checkboxes (and
modify existing ones) using the 'EditPageBeforeEditChecks'
hook. This prevents us from ever changing the format of
the HTML (e.g. to use OOUI checkboxes).

Introduce new method getCheckboxesDefinition(), which
generates the checkboxes in a machine-readable format,
with a new hook 'EditPageGetCheckboxesDefinition'.
Rewrite getCheckboxes() in terms of that. The old hook
'EditPageBeforeEditChecks' is now deprecated.

Change-Id: I3dbe973dcac6cba0c3a1ac5d983cafcfb49d833c
2017-03-29 22:03:22 +02:00
Bartosz Dziewoński
9a5d159e83 EditPage: Minor code style improvements
Mostly whitespace fixes. Avoiding some temporary variables.

Change-Id: I65f31f2bdd01ab677caff5f628222993ad719c2f
2017-03-25 17:24:16 +01:00
Sam Wilson
6e7c7f9d76 Remove the localStorage replication of the block cookie
The block cookie was being replicated to localStorage in an attempt
to make it harder for users to get around the block by deleting the
cookie (and changing IP addresses).

This whole setup was hard to test, had a few bugs (e.g. the localStorage
value would never expire), and given that it is a minor improvement
over just a plain cookie, it is now being removed. The cookie is only
intended to stop casual block-evaders (other users will get around it
by deleting the cookie or using incognito mode) and so it is not felt
worth having the extra complexity that will only guard against people
who know to remove cookies, not use incognito mode, and yet don't know
to remove localStorage.

Bug: T152952
Change-Id: Ifb06dc2390f4d648d7fcb39e30267de5eddc6941
2017-03-17 11:58:48 -07:00
addshore
49aa4cf14c EditPage: Remove checks for false contentModel
contentModel should always have a value here.

Change-Id: I38ab7211d63ec8b729965e8eefef4ed330f7b1f9
2017-03-04 11:50:48 +00:00
jenkins-bot
aa3319c4c0 Merge "Miscellaneous indentation tweaks" 2017-02-28 18:38:36 +00:00
jenkins-bot
dcfec00f3b Merge "Make EditPage::incrementConflictStats protected" 2017-02-28 18:35:53 +00:00
jenkins-bot
17eda64357 Merge "includes: Replace implicit Bugzilla bug numbers with Phab ones" 2017-02-28 00:51:57 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
addshore
5cd19c7f70 Make EditPage::incrementConflictStats protected
This will be overridden by the TwoColConflict
extension & beta feature...

Bug: T158754
Change-Id: Ia0099540032da2d490b2a8eee82a7ae70eff0f9e
2017-02-26 16:50:21 +00:00
jenkins-bot
bab4f5d64e Merge "Use Database::addQuotes instead of hard coded apostrophs" 2017-02-24 20:56:22 +00:00
Umherirrender
4d16c2ad56 Use Database::addQuotes instead of hard coded apostrophs
Change-Id: I1404d68d7e2b7fde8f9a76c747bc2be0936f7bef
2017-02-22 18:55:56 +01:00
addshore
82c264dc74 EditPage: Throw exceptions on false contentModel
contentModel should always have a value here.

Change-Id: Iba2538f383de7da94bd0e0e3eb7d7eca4e6cee7c
2017-02-22 14:56:27 +00:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
jenkins-bot
73c06b729f Merge "EditPage: Factor stats collection into private methods" 2017-02-01 04:08:42 +00:00
jenkins-bot
39cd742864 Merge "EditPage: switch from NS_CATEGORY check to instanceof CategoryPage" 2017-01-30 19:57:40 +00:00
addshore
244e8299d1 EditPage: switch from NS_CATEGORY check to instanceof CategoryPage
Change-Id: I0ee3672a3d698eda25191bccbbc10c9e2f9f7546
2017-01-26 20:06:10 +01:00
addshore
630b89b1f0 EditPage: Factor stats collection into private methods
Change-Id: Iad54ee22584077c6a7be6f2b050c3c4686b408c4
2017-01-26 19:47:26 +01:00
addshore
c814827d79 EditPage: Mark public functions
Change-Id: I269db9dcbf9cc6ef75a323eb395d12faa09ea20e
2017-01-26 19:44:11 +01:00
jenkins-bot
bb90278a2c Merge "Soft deprecated EditPage::submit to avoid new use" 2017-01-23 17:47:29 +00:00
addshore
b480a4fa99 Soft deprecated EditPage::submit to avoid new use
Currently this has no usages.
::edit can be called directly

Change-Id: I892e3de61c0513dc186d0f35e05107ed7136447d
2017-01-23 18:12:08 +01:00
jenkins-bot
ea23bc97ee Merge "Replaced all deprecated Linker methods with proper ones in core(1)" 2017-01-21 19:33:09 +00:00