'type' => 'user',
'ipallowed' => true,
'iprange' => true,
- 'label-message' => 'ipaddressorusername',
'id' => 'mw-bi-target',
'size' => '45',
'autofocus' => true,
'required' => true,
'validation-callback' => [ __CLASS__, 'validateTargetField' ],
+ 'section' => 'target',
+ ];
+
+ $a['Editing'] = [
+ 'type' => 'check',
+ 'label-message' => 'block-prevent-edit',
+ 'default' => true,
+ 'section' => 'actions',
+ 'disabled' => $enablePartialBlocks ? false : true,
];
if ( $enablePartialBlocks ) {
$a['EditingRestriction'] = [
'type' => 'radio',
- 'label' => $this->msg( 'ipb-type-label' )->text(),
+ 'cssclass' => 'mw-block-editing-restriction',
'options' => [
$this->msg( 'ipb-sitewide' )->text() => 'sitewide',
$this->msg( 'ipb-partial' )->text() => 'partial',
],
+ 'section' => 'actions',
];
$a['PageRestrictions'] = [
'type' => 'titlesmultiselect',
'input' => [
'autocomplete' => false
],
+ 'section' => 'actions',
];
}
- $a['Expiry'] = [
- 'type' => 'expiry',
- 'label-message' => 'ipbexpiry',
- 'required' => true,
- 'options' => $suggestedDurations,
- 'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
- ];
-
- $a['Reason'] = [
- 'type' => 'selectandother',
- // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
- // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
- // Unicode codepoints (or 255 UTF-8 bytes for old schema).
- 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
- 'maxlength-unit' => 'codepoints',
- 'label-message' => 'ipbreason',
- 'options-message' => 'ipbreason-dropdown',
- ];
-
$a['CreateAccount'] = [
'type' => 'check',
'label-message' => 'ipbcreateaccount',
'default' => true,
+ 'section' => 'actions',
];
if ( self::canBlockEmail( $user ) ) {
$a['DisableEmail'] = [
'type' => 'check',
'label-message' => 'ipbemailban',
+ 'section' => 'actions',
];
}
'type' => 'check',
'label-message' => 'ipb-disableusertalk',
'default' => false,
+ 'section' => 'actions',
];
}
+ $a['Expiry'] = [
+ 'type' => 'expiry',
+ 'required' => true,
+ 'options' => $suggestedDurations,
+ 'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
+ 'section' => 'expiry',
+ ];
+
+ $a['Reason'] = [
+ 'type' => 'selectandother',
+ // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+ // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+ // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+ 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
+ 'maxlength-unit' => 'codepoints',
+ 'options-message' => 'ipbreason-dropdown',
+ 'section' => 'reason',
+ ];
+
$a['AutoBlock'] = [
'type' => 'check',
'label-message' => 'ipbenableautoblock',
'default' => true,
+ 'section' => 'options',
];
# Allow some users to hide name from block log, blocklist and listusers
'type' => 'check',
'label-message' => 'ipbhidename',
'cssclass' => 'mw-block-hideuser',
+ 'section' => 'options',
];
}
$a['Watch'] = [
'type' => 'check',
'label-message' => 'ipbwatchuser',
+ 'section' => 'options',
];
}
'type' => 'check',
'label-message' => 'ipb-hardblock',
'default' => false,
+ 'section' => 'options',
];
# This is basically a copy of the Target field, but the user can't change it, so we
* @return string
*/
protected function preText() {
- $this->getOutput()->addModuleStyles( 'mediawiki.widgets.TagMultiselectWidget.styles' );
+ $this->getOutput()->addModuleStyles( [
+ 'mediawiki.widgets.TagMultiselectWidget.styles',
+ 'mediawiki.special',
+ ] );
$this->getOutput()->addModules( [ 'mediawiki.special.block' ] );
$blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' );
}
$status = $currentBlock->update();
+ // TODO handle failure
$logaction = 'reblock';
if ( (bool)$currentBlock->mHideName ) {
$data['HideUser'] = true;
}
+
+ $block = $currentBlock;
}
} else {
$logaction = 'block';
$logEntry->setComment( $data['Reason'][0] );
$logEntry->setPerformer( $performer );
$logEntry->setParameters( $logParams );
- # Relate log ID to block IDs (T27763)
- $blockIds = array_merge( [ $status['id'] ], $status['autoIds'] );
- $logEntry->setRelations( [ 'ipb_id' => $blockIds ] );
+ # Relate log ID to block ID (T27763)
+ $logEntry->setRelations( [ 'ipb_id' => $block->getId() ] );
$logId = $logEntry->insert();
if ( !empty( $data['Tags'] ) ) {