X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialAllMessages.php;h=f6b8b90522b4935e0edf16c0a62f5f621aabf225;hb=d6dd6e4d7220a7b34d0256acf50cbeee8b7f22c0;hp=9e66447fe3bce8eaa04c55388c310c23442e0aad;hpb=d19826aa35b206847a568a4b2c1c9ffaa615fca5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialAllMessages.php b/includes/specials/SpecialAllMessages.php index 9e66447fe3..f6b8b90522 100644 --- a/includes/specials/SpecialAllMessages.php +++ b/includes/specials/SpecialAllMessages.php @@ -20,6 +20,7 @@ * @file * @ingroup SpecialPage */ +use MediaWiki\MediaWikiServices; /** * Use this special page to get a list of the MediaWiki system messages. @@ -28,44 +29,96 @@ * @ingroup SpecialPage */ class SpecialAllMessages extends SpecialPage { - /** - * @var AllMessagesTablePager - */ - protected $table; public function __construct() { parent::__construct( 'Allmessages' ); } /** - * Show the special page - * - * @param string $par Parameter passed to the page or null + * @param string|null $par Parameter passed to the page or null */ public function execute( $par ) { - $request = $this->getRequest(); $out = $this->getOutput(); $this->setHeaders(); if ( !$this->getConfig()->get( 'UseDatabaseMessages' ) ) { - $out->addWikiMsg( 'allmessagesnotsupportedDB' ); + $out->addWikiMsg( 'allmessages-not-supported-database' ); return; } - $this->outputHeader( 'allmessagestext' ); $out->addModuleStyles( 'mediawiki.special' ); $this->addHelpLink( 'Help:System message' ); - $this->table = new AllMessagesTablePager( - $this, - [], - wfGetLangObj( $request->getVal( 'lang', $par ) ) - ); + $contLang = MediaWikiServices::getInstance()->getContentLanguage()->getCode(); + $lang = $this->getLanguage(); + + $opts = new FormOptions(); + + $opts->add( 'prefix', '' ); + $opts->add( 'filter', 'all' ); + $opts->add( 'lang', $contLang ); + $opts->add( 'limit', 50 ); + + $opts->fetchValuesFromRequest( $this->getRequest() ); + $opts->validateIntBounds( 'limit', 0, 5000 ); + + $pager = new AllMessagesTablePager( $this->getContext(), $opts ); + + $formDescriptor = [ + 'prefix' => [ + 'type' => 'text', + 'name' => 'prefix', + 'label-message' => 'allmessages-prefix', + ], + + 'filter' => [ + 'type' => 'radio', + 'name' => 'filter', + 'label-message' => 'allmessages-filter', + 'options-messages' => [ + 'allmessages-filter-unmodified' => 'unmodified', + 'allmessages-filter-all' => 'all', + 'allmessages-filter-modified' => 'modified', + ], + 'default' => 'all', + 'flatlist' => true, + ], + + 'lang' => [ + 'type' => 'language', + 'name' => 'lang', + 'label-message' => 'allmessages-language', + 'default' => $opts->getValue( 'lang' ), + ], + + 'limit' => [ + 'type' => 'limitselect', + 'name' => 'limit', + 'label-message' => 'table_pager_limit_label', + 'options' => [ + $lang->formatNum( 20 ) => 20, + $lang->formatNum( 50 ) => 50, + $lang->formatNum( 100 ) => 100, + $lang->formatNum( 250 ) => 250, + $lang->formatNum( 500 ) => 500, + $lang->formatNum( 5000 ) => 5000, + ], + 'default' => $opts->getValue( 'limit' ), + ], + ]; + + $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ); + $htmlForm + ->setMethod( 'get' ) + ->setIntro( $this->msg( 'allmessagestext' ) ) + ->setWrapperLegendMsg( 'allmessages' ) + ->setSubmitTextMsg( 'allmessages-filter-submit' ) + ->prepareForm() + ->displayForm( false ); - $out->addHTML( $this->table->buildForm() ); - $out->addParserOutputContent( $this->table->getFullOutput() ); + $out->addParserOutputContent( $pager->getFullOutput() ); } protected function getGroupName() {