$out = $this->getOutput();
$lang = $this->getLanguage();
$out->setPageTitle( $this->msg( 'ipblocklist' ) );
- $out->addModuleStyles( 'mediawiki.special' );
- $out->addModules( 'mediawiki.userSuggest' );
+ $out->addModuleStyles( array( 'mediawiki.special', 'mediawiki.special.blocklist' ) );
$request = $this->getRequest();
$par = $request->getVal( 'ip', $par );
return;
}
+ # setup BlockListPager here to get the actual default Limit
+ $pager = $this->getBlockListPager();
+
# Just show the block list
$fields = array(
'Target' => array(
- 'type' => 'text',
+ 'type' => 'user',
'label-message' => 'ipaddressorusername',
'tabindex' => '1',
'size' => '45',
'default' => $this->target,
- 'cssclass' => 'mw-autocomplete-user', // used by mediawiki.userSuggest
),
'Options' => array(
'type' => 'multiselect',
- 'options' => array(
- $this->msg( 'blocklist-userblocks' )->text() => 'userblocks',
- $this->msg( 'blocklist-tempblocks' )->text() => 'tempblocks',
- $this->msg( 'blocklist-addressblocks' )->text() => 'addressblocks',
- $this->msg( 'blocklist-rangeblocks' )->text() => 'rangeblocks',
+ 'options-messages' => array(
+ 'blocklist-userblocks' => 'userblocks',
+ 'blocklist-tempblocks' => 'tempblocks',
+ 'blocklist-addressblocks' => 'addressblocks',
+ 'blocklist-rangeblocks' => 'rangeblocks',
),
'flatlist' => true,
),
$lang->formatNum( 500 ) => 500,
),
'name' => 'limit',
- 'default' => 50,
+ 'default' => $pager->getLimit(),
),
);
$context = new DerivativeContext( $this->getContext() );
$context->setTitle( $this->getPageTitle() ); // Remove subpage
- $form = new HTMLForm( $fields, $context );
+ $form = HTMLForm::factory( 'ooui', $fields, $context );
$form->setMethod( 'get' );
$form->setWrapperLegendMsg( 'ipblocklist-legend' );
$form->setSubmitTextMsg( 'ipblocklist-submit' );
$form->prepareForm();
$form->displayForm( '' );
- $this->showList();
+ $this->showList( $pager );
}
- function showList() {
+ /**
+ * Setup a new BlockListPager instance.
+ * @return BlockListPager
+ */
+ protected function getBlockListPager() {
$conds = array();
# Is the user allowed to see hidden blocks?
if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
$conds[] = "ipb_range_end = ipb_range_start";
}
+ return new BlockListPager( $this, $conds );
+ }
+
+ /**
+ * Show the list of blocked accounts matching the actual filter.
+ * @param BlockListPager $pager The BlockListPager instance for this page
+ */
+ protected function showList( BlockListPager $pager ) {
+ $out = $this->getOutput();
+
# Check for other blocks, i.e. global/tor blocks
$otherBlockLink = array();
Hooks::run( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) );
- $out = $this->getOutput();
-
# Show additional header for the local block only when other blocks exists.
# Not necessary in a standard installation without such extensions enabled
if ( count( $otherBlockLink ) ) {
);
}
- $pager = new BlockListPager( $this, $conds );
if ( $pager->getNumRows() ) {
$out->addParserOutputContent( $pager->getFullOutput() );
} elseif ( $this->target ) {
function formatValue( $name, $value ) {
static $msg = null;
if ( $msg === null ) {
- $msg = array(
+ $keys = array(
'anononlyblock',
'createaccountblock',
'noautoblockblock',
'unblocklink',
'change-blocklink',
);
- $msg = array_combine( $msg, array_map( array( $this, 'msg' ), $msg ) );
+
+ foreach ( $keys as $key ) {
+ $msg[$key] = $this->msg( $key )->escaped();
+ }
}
/** @var $row object */
$row = $this->mCurrentRow;
+ $language = $this->getLanguage();
+
$formatted = '';
switch ( $name ) {
case 'ipb_timestamp':
- $formatted = $this->getLanguage()->userTimeAndDate( $value, $this->getUser() );
+ $formatted = htmlspecialchars( $language->userTimeAndDate( $value, $this->getUser() ) );
break;
case 'ipb_target':
break;
case 'ipb_expiry':
- $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */true );
+ $formatted = htmlspecialchars( $language->formatExpiry(
+ $value,
+ /* User preference timezone */true
+ ) );
if ( $this->getUser()->isAllowed( 'block' ) ) {
if ( $row->ipb_auto ) {
$links[] = Linker::linkKnown(
'span',
array( 'class' => 'mw-blocklist-actions' ),
$this->msg( 'parentheses' )->rawParams(
- $this->getLanguage()->pipeList( $links ) )->escaped()
+ $language->pipeList( $links ) )->escaped()
);
}
break;
$properties[] = $msg['blocklist-nousertalk'];
}
- $formatted = $this->getLanguage()->commaList( $properties );
+ $formatted = $language->commaList( $properties );
break;
default: