jenkins-bot has submitted this change and it was merged.
Change subject: Update to match changes done in SpecialPreferences
......................................................................
Update to match changes done in SpecialPreferences
This also replaces deprecated use of wfMsg*
Bug: T70750
Change-Id: Ic2764145db31f676bb3b5d2c7441cdb27381ff78
---
M EditUser.php
M EditUserPreferencesForm.php
M EditUser_body.php
M i18n/en.json
M i18n/qqq.json
5 files changed, 92 insertions(+), 24 deletions(-)
Approvals:
Paladox: Looks good to me, approved
jenkins-bot: Verified
diff --git a/EditUser.php b/EditUser.php
index 9b61b43..f2c3771 100644
--- a/EditUser.php
+++ b/EditUser.php
@@ -25,6 +25,7 @@
// Special page classes
$wgAutoloadClasses['EditUser'] = __DIR__ . '/EditUser_body.php';
$wgAutoloadClasses['EditUserPreferencesForm'] = __DIR__ .
'/EditUserPreferencesForm.php';
+
$wgSpecialPages['EditUser'] = 'EditUser';
// Default group permissions
diff --git a/EditUserPreferencesForm.php b/EditUserPreferencesForm.php
index d5b6ee0..8346d52 100644
--- a/EditUserPreferencesForm.php
+++ b/EditUserPreferencesForm.php
@@ -6,13 +6,17 @@
}
function getButtons() {
+ $attrs = array( 'id' => 'mw-prefs-restoreprefs' );
+
$html = HTMLForm::getButtons();
$url = SpecialPage::getTitleFor( 'EditUser' )->getFullURL(
array( 'reset' => 1, 'username' =>
$this->getModifiedUser()->getName() )
);
- $html .= "\n" . Xml::element( 'a', array( 'href'=> $url ),
wfMsgHtml( 'restoreprefs' ) );
+ $html .= "\n" . Xml::element( 'a', array( 'href'=> $url ),
+ $this->msg( 'restoreprefs' )->escaped(),
+ Html::buttonAttributes( $attrs, array(
'mw-ui-quiet' ) ) );
$html = Xml::tags( 'div', array( 'class' => 'mw-prefs-buttons'
), $html );
diff --git a/EditUser_body.php b/EditUser_body.php
index 172c6e6..aaa4555 100644
--- a/EditUser_body.php
+++ b/EditUser_body.php
@@ -1,18 +1,43 @@
<?php
-/* Shamelessly copied and modified from
/includes/specials/SpecialPreferences.php v1.16.1 */
-class EditUser extends SpecialPage {
+/* Shamelessly copied and modified from
/includes/specials/SpecialPreferences.php v1.27alpha */
+/**
+ * Implements Special:Preferences
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
+ */
+/**
+ * A special page that allows users to change their preferences
+ *
+ * @ingroup SpecialPage
+ */
+class EditUser extends SpecialPage {
function __construct() {
parent::__construct( 'EditUser', 'edituser' );
}
- function execute( $par ) {
+ public function execute( $par ) {
$user = $this->getUser();
$out = $this->getOutput();
if ( !$user->isAllowed( 'edituser' ) ) {
- $out->permissionRequired( 'edituser' );
- return false;
+ throw new PermissionsError( 'edituser' );
}
$this->setHeaders();
@@ -39,33 +64,51 @@
$this->outputHeader();
$out->disallowUserJs(); # Prevent hijacked user scripts from
sniffing passwords etc.
- if ( wfReadOnly() ) {
- $out->readOnlyPage();
- return;
- }
+ $this->checkReadOnly();
if ( $request->getCheck( 'reset' ) ) {
$this->showResetForm();
+
return;
}
$out->addModules( 'mediawiki.special.preferences' );
+ $out->addModuleStyles( 'mediawiki.special.preferences.styles' );
// $this->loadGlobals( $this->target );
$out->addHtml( $this->makeSearchForm() . '<br />' );
# End EditUser additions
- if ( $request->getCheck( 'success' ) ) {
+ if ( $this->getRequest()->getCheck( 'success' ) ) {
$out->wrapWikiMsg(
- "<div
class=\"successbox\"><strong>\n$1\n</strong></div><div
id=\"mw-pref-clear\"></div>",
+ Html::rawElement(
+ 'div',
+ array(
+ 'class' =>
'mw-preferences-messagebox successbox',
+ 'id' => 'mw-preferences-success'
+ ),
+ Html::element( 'p', array(), '$1' )
+ ),
'savedprefs'
);
}
- if ( $request->getCheck( 'eauth' ) ) {
- $out->wrapWikiMsg( "<div class='error' style='clear:
both;'>\n$1\n</div>",
-
'eauthentsent', $this->target );
+ if ( $this->getRequest()->getCheck( 'eauth' ) ) {
+ $out->wrapWikiMsg(
+ Html::rawElement(
+ 'div',
+ array(
+ 'class' => 'error',
+ 'style' => 'clear: both;'
+ ),
+ Html::element( 'p', array(), '$1' )
+ ),
+ 'eauthentsent',
+ $this->target
+ );
}
+
+ $this->addHelpLink( 'Help:Preferences' );
$htmlForm = Preferences::getFormObject( $targetuser,
$this->getContext(),
'EditUserPreferencesForm', array( 'password' ) );
@@ -75,12 +118,20 @@
$htmlForm->show();
}
- function showResetForm() {
+ private function showResetForm() {
+ if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) {
+ throw new PermissionsError( 'editmyoptions' );
+ }
+
+ if ( !$this->getUser()->isAllowed( 'edituser' ) ) {
+ throw new PermissionsError( 'edituser' );
+ }
+
$this->getOutput()->addWikiMsg( 'prefs-reset-intro' );
$htmlForm = new HTMLForm( array(), $this->getContext(),
'prefs-restore' );
- $htmlForm->setSubmitText( wfMsg( 'restoreprefs' ) );
+ $htmlForm->setSubmitTextMsg( 'restoreprefs' );
$htmlForm->addHiddenField( 'username', $this->target );
$htmlForm->addHiddenField( 'reset', '1' );
$htmlForm->setSubmitCallback( array( $this, 'submitReset' ) );
@@ -89,18 +140,26 @@
$htmlForm->show();
}
- function submitReset( $formData ) {
- $this->targetuser->resetOptions();
+ public function submitReset( $formData ) {
+ if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) {
+ throw new PermissionsError( 'editmyoptions' );
+ }
+
+ if ( !$this->getUser()->isAllowed( 'edituser' ) ) {
+ throw new PermissionsError( 'edituser' );
+ }
+
+ $this->targetuser->resetOptions( 'all', $this->getContext() );
$this->targetuser->saveSettings();
- $url = $this->getTitle()->getFullURL( array( 'success' => 1,
'username'=>$this->target ) );
+ $url = $this->getTitle()->getFullURL( array( 'success' => 1,
'username' => $this->target ) );
$this->getOutput()->redirect( $url );
return true;
}
- function makeSearchForm() {
+ public function makeSearchForm() {
global $wgScript;
$fields = array();
@@ -114,7 +173,7 @@
return $form;
}
- function getGroupName() {
+ protected function getGroupName() {
return 'users';
}
}
diff --git a/i18n/en.json b/i18n/en.json
index 9452635..e5f9f7e 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,5 +12,7 @@
"edituser-nouser": "The user \"$1\" does not exist.",
"edituser-exempt": "The user \"$1\" cannot be edited.",
"right-edituser": "Edit the preferences of other users",
- "right-edituser-exempt": "Others cannot edit this user's preferences"
+ "right-edituser-exempt": "Others cannot edit this user's preferences",
+ "action-edituser": "edit the preferences of other users",
+ "action-edituser-exempt": "others cannot edit this user's preferences"
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index e897689..3acad37 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -16,5 +16,7 @@
"edituser-nouser": "Used for saying that the user does not exist.",
"edituser-exempt": "Used for saying the user cannot be edited.",
"right-edituser": "{{doc-right|edituser}}",
- "right-edituser-exempt": "{{doc-right|edituser-exempt}}"
+ "right-edituser-exempt": "{{doc-right|edituser-exempt}}",
+ "action-edituser": "{{doc-action|edituser}}",
+ "action-edituser-exempt": "{{doc-action|edituser-exempt}}"
}
--
To view, visit https://gerrit.wikimedia.org/r/255941
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2764145db31f676bb3b5d2c7441cdb27381ff78
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/EditUser
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits