Commit graph

1453 commits

Author SHA1 Message Date
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
Yuriy Shnitkovskiy
55667f024d Replaced all deprecated Linker methods with proper ones in core(1)
Change-Id: Ie3a718dc1eae1507f8829fcf419c64c6846d2cb6
2017-01-20 11:46:13 +02:00
rlot
99800a9e03 Removed deprecated ContentHandler hooks.
Plus removed unused "ContentHandler::runLegacyHooks"

Bug: T154498
Change-Id: Ie398fd4e06d3e286fe8e24112d0c8b4ac7d883dc
2017-01-18 21:19:17 +00:00
Chad Horohoe
0fa3413576 Remove cols and rows preferences
In https://gerrit.wikimedia.org/r/80061/, Chad was convinced this
preference is barely used and mostly set to weird values by people
who don't understand what they're doing.

He made some quick stats: http://p.defau.lt/?fgGU0StB4J9l0LC5GZq8AA

Used defaults of 80 columns and 25 rows in places that still
were asking for it. The old default values are left in
$wgDefaultUserOptions for now, since various extensions are
using them.

The 'rows' and 'columns' messages don't appear to be in use in
any extensions in Git, so I killed those as well.

(This is the same as I642188c74d929a586b1882a1cf8656056c4fcf5a.)

Bug: T26430
Change-Id: I6c9802bc4f9cf32fb75c3dd7b9e2dc18f271eedf
2017-01-09 21:56:57 +11:00
Bartosz Dziewoński
8e5b626f8c EditPage: Make makeTemplatesOnThisPageList() public
We want to use it in VE: I63e663d05aefb47274f1f28bdcafc5317c2fc4f6.

Bug: T149009
Change-Id: Id617f9afbddf094140133f9659efc4b4e746148c
2017-01-04 18:21:47 +01:00
Justin Du
074d6ea86f EditPage: Avoid use of &$this in hooks
* This triggers warnings in PHP 7.1

Bug: T153505
Change-Id: I5324a6bfe9e8ed255975104c5de7e7a7011cb741
2016-12-28 07:39:27 +00:00
cenarium
7d7f8e2ae2 Pass undone revision id to PageContentSaveComplete hook
This passes the id of the revision that was undone to the
PageContentSaveComplete hook, since this hook is now inside a deferred
update so extensions can no longer rely on 'wpUndidRevision' being
present in the request.

Change-Id: I50dcb841cd0616acc2d69c3a685ba3cb339986c3
2016-12-19 17:19:39 +01:00
Brad Jorsch
01a3b2b0bf Add the concept of "system blocks"
Blocks made for configured proxies, dnsbls, or the configured range
soft-blocks being added in I6c11a6b9 aren't real blocks stored in the
database. Let's actually flag these blocks as such and use a more
appropriate message when displaying them to the user.

Change-Id: I697e3eec2520792e98c193200c2b1c28c35bf382
2016-12-16 12:30:03 -05:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08:00
Reedy
2c74b04356 ArticleViewCustom, EditPageGetDiffText and ShowRawCssJs were removed
Bug: T145728
Change-Id: Iddf29005abbaceaa1e3cc2c79e4becfb46294414
2016-12-03 12:27:07 +00:00
jenkins-bot
1f83b42429 Merge "Remove last remnants of pre-1.16 live preview" 2016-11-18 21:56:35 +00:00