Commit graph

154 commits

Author SHA1 Message Date
Alexandre Emsenhuber
81de35ad40 And I of course forgot to commit ProtectionForm.php in r106567... 2011-12-18 16:02:14 +00:00
Jeroen De Dauw
a62e242a30 revert r106095, fix apparently not this simple 2011-12-13 21:34:16 +00:00
Jeroen De Dauw
29e81897f9 logName -> getName 2011-12-13 21:17:32 +00:00
Alexandre Emsenhuber
f8e2b347a5 * Changed OutputPage's handling of subtitles to use an array and implode it with "<br />" so that callers don't have to bother whether there's already a subtitle when adding new ones
* Make OutputPage::setSubtitle(), OutputPage::addSubtitle() and OutputPage::appendSubtitle() accept a Message object in addition to a string
* Added new method OutputPage::addSubtitle() to replace appendSubtitle() and marked it as deprecated
* Clear the subtitles when showing an error page
* Always show the subtitle from Article::viewRedirect() when showing a page; left the parameter for use in EditPage
* Make Article::setOldSubtitle() add two subtitles and has to set "display:inline;" for the three possible divs to avoid too many spacing
* Removed the six different backlink subtitles and added one new message 'backlinksubtitle' to replace them and added OutputPage::addBacklinkSubtitle() to factorise common code
* Changed EditPage's view source to show "View source for <Page>" with the same backlink in subtitle for consistency with other back links and page titles
2011-11-08 18:01:22 +00:00
Alexandre Emsenhuber
41e944bac2 Some cleanup to ProtectionForm:
* When the user doesn't have permission to protect/unprotect the page, display a page with the title set to "View protection level for ...", then the permissions errors and the current protection levels. Except for the title, this was already the case for permissions errors, but when the database was read-only this was throwing an exception due to the change in OutputPage::readOnlyPage()  
* Moved check for NS_MEDIAWIKI a level up, so that is it also catched on page save, and make the output in such case much more user friendly
* Changed edit token to be salted with array( 'protect', 'page name' ) (as for action=watch)
* Allow extensions to return false in ProtectionForm::save hook for consistency with other hooks and in that case fill the error message with 'hookaborted' if the extension does not provide an customised error message.
* Changed ProtectionForm::show() to accept an array of message name and its parameters in addition of a string with raw HTML and converted calls to use the new method. This also means that ProtectionForm::save can use this 
* Removed the setSubtitle() call for the 'formerror' message in case of error since it's overriden by the "back link"
2011-11-01 15:45:52 +00:00
Alexandre Emsenhuber
b212bace90 Per Nikerabbit's comment on r100621:
* Removed OutputPage::setPageTitleMsg() and OutputPage::setHTMLTitleMsg() and make OutputPage::setPageTitle() and OutputPage::setHTMLTitle() accept a Message object
* Updated core calls (including some that I missed last time because of non-matching case)
* Added Message::setContext() and use it in RequestContext so that I don't need to duplicate the call in OutputPage
* Yes, I'm calling $this->msg() on places and then setting the context one more time in OutputPage::setPageTitle() or OutputPage::setHTMLTitle(), but at least I won't be confused about which objects $
2011-10-27 20:23:16 +00:00
Alexandre Emsenhuber
ae45908c59 Added OutputPage::setPageTitleMsg() and OutputPage::setHTMLTitleMsg() as modified versions of OutputPage::setPageTitle() and OutputPage::setHTMLTitle() that take an message name and its parameters; updated all calls in core that can use the two new functions 2011-10-24 17:24:38 +00:00
Krinkle
32327650c5 clean up Html::inlineScript usage
* ResourceLoader::makeLoaderConditionalScript:
-- window.mediaWiki -> window.mw; Not just because it's shorter but because that's the variable that is actually being used inside the script.
* ProtectionForm::buildCleanupScript
-- Use a single quote string and no new line
-- Use ResourceLoader::makeLoaderConditionalScript instead of duplicating this logic everywhere
* ProtectionForm::buildCleanupScript:
-- Use Xml::encodeJsCall to render javascript code
-- Use ResourceLoader::makeLoaderConditionalScript
-- Fix bug 31230 by using the new OutputPage->addJsConfigVars( r98374 )
(had to use $wgOut for now since there wasn't an obvious route to a context that I could find here (Article has context, but ProtectionForm::__construct takes any WikiPage, not just Article)
* EditPage::getEditToolbar:
-- Use Xml::encodeJsCall
-- Use ResourceLoader::makeLoaderConditionalScript

Fixes:
* (bug 31230) ProtectionForm should set wgCascadeableLevels in mw.confg instead of globally
2011-09-28 22:47:05 +00:00
Alexandre Emsenhuber
85cfb00304 Allow LogEventsList::showLogExtract() to get a Title object instead of having to do Title -> string -> Title conversion 2011-09-24 17:52:53 +00:00
Alexandre Emsenhuber
9baf1901a1 Call Linker methods statically 2011-09-13 11:10:05 +00:00
Daniel Friesen
476731f179 Followup r80248; Fix inverted message exists tests in ProtectionForm. 2011-08-17 14:10:41 +00:00
Rotem Liss
53e9941f36 In the protection form, show the current protection expiry time in the local time and not in UTC. 2011-08-03 07:33:00 +00:00
Aaron Schulz
930ccf282c * Split off WikiPage class from Article, WikiFilePage class from ImagePage, and WikiCategoryPage from CategoryPage.
* WikiPage functions/fields are "magically" part of Article when accessed for b/c. Magic is kind of ugly but there are too many callers to make breaking changes atm. Some functions are just wrappers for WikiPage ones (were magic won't work).
* Added newFromID() to each WikiPage subclass (works around pre-existing inheritance problem).
* Added Page class for convenient type hinting and changed hints from Article -> Page. This lets things use WikiPage objects without getting type errors.
* Updated FlaggedPage to extend WikiPage. Worked around getOldIdFromRequest().
* Added setTimestamp() to WikiPage and moved some timestamp setting code from ParserCache to Article.
* Removed ampersands from $dbw arguments.
* @TODO: dependency inject user objects for WikiPage

The idea is to migrate things to use WikiPage, as the run-of-the-mill "new Article()" call doesn't care about $oldid and $wgRequest. After that, Article, ImagePage, and CategoryPage can be rewritten as an Action class or something sane (a Viewer class of sorts).
2011-06-29 22:09:51 +00:00
Aaron Schulz
55c6aed1ab Removed raw Article->field accessing 2011-06-28 14:10:55 +00:00
Matěj Grabovský
c8c3159a85 Follow-up r90371, per comment by ^demon
Escape wikitext in username before passing it to certain messages; also remove <nowiki>s in those as they're superfluous.
2011-06-20 19:45:35 +00:00
Krinkle
2d03eedf8a WatchAction requires token (BREAKING CHANGE)
* (bug 27655) Require token for watching/unwatching pages
* Previously done for API (bug 29070) in r88522
* As with markpatrolled, the tokens are not compatible and made that way on purpose. The API requires the POST method and uses a universal token per-session. Since the front-end is all GET based (also per convention like in markpatrolled and rollback) they are stronger salted (title / action specific)
* ajax.watch used the API already and was switched in r88554.
* The actual watching/unwatching code was moved from WatchAction->onView to WatchAction::doWatch. This was done to allow the API to do the action without needing to generate a token like the front-end needs (or having to duplicate code). It is now similar to RecentChange::markPatrolled (in that it  also a "central" function that does not care about tokens, it's called after the token-handling)
* JavaScript / Gadgets that utilize action=watch in their scripts:
** Effects should be minimal as they should be using the API (see r88522 and wikitech-l)
** If they use index.php and scrap the link from the page, they can continue to do so.

* There are links to the watch action all over the place. I've tried to catch most of them, but there may be some I miss. Migration in most cases is just a matter of adding an array item to the $query for:
 'token' => WatchAction::getWatchToken( $title, $user [, $action] )
or changing:
 Action::factory( 'watch', $article )->execute();
to:
 WatchAction::doWatch( $title, $user );

While replacing the usages in some cases an instance of Article() no longer had to be created, in others $wgUser had to be retrieved from global (which was implied before but needs to be given directly now)

Other notes:
* Article->unwatch() and Article->watch(), which were deprecated as of 1.18 and are no longer used in core, may be broken in scenarios where the Request does not have a 'token' but is making a call to $article->watch()
* Some extensions need to be fixed, I'm currently running a grep search and will fix them a.s.a.p 


[1] http://www.mediawiki.org/wiki/ResourceLoader/Default_modules?mw.user#tokens
2011-06-06 00:09:03 +00:00
Sam Reed
36cb6833e4 More documentation updates and additions
Getting bored of this tonight now I think...
2011-05-21 20:06:57 +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
Roan Kattouw
7611624a1a (bug 16921) Add JavaScript-based enforcing of byte limits on move and protection forms. Patch by Jan Paul Posma 2011-04-25 11:39:30 +00:00
Happy-melon
8779f4b55f r86001, now with less scariness :P I took out the delete action and did purge instead, which is a much more self-contained action-with-a-form. Also implement a few changes suggested by Brion on IRC last night. 2011-04-14 10:38:29 +00:00
Happy-melon
bc4a096805 Revert r86001: Brion says it's too scary :D will recommit in pieces 2011-04-13 23:36:27 +00:00
Happy-melon
6dc8136d12 New infrastructure for actions, as discussed on wikitech-l. Fairly huge commit.
* Actions come in two flavours: the show-a-form-then-do-something-with-the-result (delete, protect, edit, etc) and the just-do-something (watch, rollback, patrol, etc).  Create abstract base classes Action and FormlessAction to support these two cases.  HTMLForm is an integral part of the form-based structure.
* Look mum, no globals!  :D  Fully context-based.
* Implement watch/unwatch, credits and delete actions in the new system as proof-of-concept.  This also gives the delete frontend a much-needed overhaul.
* Stub out the newly-deprecated functions from Article.php.  This already reduces its linecount by about 15%, and there are plenty more actions still to do.
* Centralising actions like this is going to render a lot of hooks type-incompatible.  There's simply nowhere you can put the ArticleConfirmDelete hook, for instance, where it can be passed an OutputPage as the second parameter.  On the other hand, we can implement new hooks like ActionModifyFormFields and ActionBeforeFormDisplay, which can do much prettier stuff to the forms, like adding extra fields the 'right' way.  Update LiquidThreads to use these new hooks where appropriate.
2011-04-13 23:04:07 +00:00
Happy-melon
21fcf991d0 Follow-ups to r84258 2011-03-18 22:28:39 +00:00
Happy-melon
ac5751ee48 Follow-up r84249: reimplement isAllowedAny(), and restore isAllowed() to only-accepting-one-parameter mode for the time being. 2011-03-18 21:07:05 +00:00
Happy-melon
81852ea1a6 Allow User::isAllowed() to take varargs. "is allowed X or Y" is by far the more common multiple permission check in core, so this is now the behaviour of isAllowed( X, Y ); also add isAllowedAll(...) for testing "is allowed X and Y". Has the nice side effect of adding visibility to a very old function. 2011-03-18 14:48:21 +00:00
Alexandre Emsenhuber
b85a785c22 We have OutputPage::showPermissionsErrorPage() for that 2011-02-08 15:19:49 +00:00
Daniel Friesen
39ab3cfc9f Implement Message::isBlank and Message::isDisabled.
And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods.
2011-01-14 10:51:05 +00:00
Platonides
b422cf8111 A couple of Xml::hidden calls left by r75723 2010-10-31 18:17:56 +00:00
Trevor Parscal
fd5ad32869 Fixed check for mediaWiki existance and removed additional unneeded wrapping in mediaWiki.loader.using calls as per comments on r73499. 2010-09-22 18:03:29 +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
Alexandre Emsenhuber
5be509b0c1 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-08 14:23:14 +00:00
Alexandre Emsenhuber
3d57cb9db8 * Use Html::linkedScript() and Html::inlineScript() 2010-06-02 19:28:44 +00:00
Alexandre Emsenhuber
9ab3d55384 Fixed some doxygen warnings and documented a bit 2010-05-23 19:25:07 +00:00
Sam Reed
b6e0df246f Attempt at normalistion of comparison styles - empty string on left and right hand side normalised to it being on the rhs
Before this change, there were (? being regex 0 or 1)

"" ===? 1
'' ===? 24
"" !==? 8
'' !==? 32

== "" 14
== '' 344
!= "" 9
!== "" 4
!= '' 151
!== '' 85


Rhs was the much more common, and the preferred style by many developers.. (Was a similar discussion in #mediawiki recently.. After that lolbugreport i think)

Where there is a string (non empty) on the lhs, and variable/method call on the rhs still need normalising
2010-01-06 19:59:42 +00:00
Matěj Grabovský
4a099928f7 (bug 21455) Fixed "Watch this page" checkbox appearing on some special pages even to non-logged in users 2009-11-14 11:07:46 +00:00
Bryan Tong Minh
6fec9d682b Follow-up to r58633 and r58628 (lqt): Rename Title::getProtectionTypes to Title::getRestrictionTypes and fix the hook name. 2009-11-09 12:05:30 +00:00
Andrew Garrett
f6f5e90888 Enabling changes for r56828: some refactoring and code cleanup of the protection interface, including a new hook, generalisation to more restriction types than edit/move, and some other related changes. 2009-11-06 10:27:44 +00:00
Bryan Tong Minh
37a8e9a147 * (bug 6579) Fixed protecting images from uploading only
* Added upload by default to $wgRestrictionTypes

Also requires MessagesEn.php accidently committed in r58536
2009-11-04 12:55:00 +00:00
Aaron Schulz
0d833fe671 * Added $wgFlaggedRevsProtectLevels to allow for site defined review "protection" levels. Disables stabilization and a small fieldset to the protection form with the options.
* Added three ProtectionForm hooks for the above
* Removed PHP4-ism from getPageVisibilitySettings()
2009-10-02 18:46:19 +00:00
Alex Z
c255da09f0 (bug 20136) Synchronize the protection form expiry boxes onchange in addition to onkeyup.
Technically the onkeyup handler is redundant, but at least on Firefox, onchange doesn't run
until after the input loses focus, so its somewhat less intuitive, but necessary if the user
clicks an option from a browser's autosuggestion
2009-09-06 04:10:26 +00:00
Ryan Schmidt
bed5f5d54e * Add autopromote condition APCOND_BLOCKED to autopromote blocked users to various user groups.
* Add $wgRemoveGroups as a means of restricting a group's rights. The syntax is identical to $wgGroupPermissions, but users in these groups will have these rights stripped from them.
* Modify Special:ListGroupRights so that it displays revoked permissions as well (the display of assigned vs. revoked is changeable via css).
* Bump $wgStyleVersion
2009-06-18 02:50:16 +00:00
Alexandre Emsenhuber
36b535d199 Kill some E_NOTICE when protecting a non-existing page 2009-06-12 18:31:07 +00:00
Alexandre Emsenhuber
8e2e5d473e Fix for r51493, r51084 and realted: use Title::makeTitle() rather than Title::newFromText() 2009-06-05 13:12:15 +00:00
Siebrand Mazeland
e17b75e76a Follow-up to r51084:
* address case sensitivity issue raised by Splarka on CR
* also change to edit link on Special:Block
2009-06-05 07:33:57 +00:00
Siebrand Mazeland
f8f8dd2cb2 Fix a usability issue on protect and [file ]delete forms. "Edit ... reasons" link now contains action=edit to save a click. 2009-05-27 20:35:16 +00:00
Niklas Laxström
4bb02cdc33 * Follow-up for r50691, add \n to be safe in case there is line-start sensitive markup 2009-05-17 15:44:51 +00:00
Siebrand Mazeland
1f4160caa1 (bug 18522) Wrap MediaWiki:Protect-cascadeon in a div for identification (patch by Happy-melon) 2009-05-17 14:57:30 +00:00
Siebrand Mazeland
547858b7fe Use link() instead of deprecated makeLinkObj() where possible. 2009-05-08 23:24:31 +00:00
Chad Horohoe
2664b438f1 Remove some unused $wgOut's. 2009-04-07 15:56:26 +00:00
Aaron Schulz
c800133fbd Break line 2009-01-26 19:11:34 +00:00