protected $IdLevel = 'level';
protected $IdType = 'type';
- function showList( $msg = '' ) {
+ public function showList( $msg = '' ) {
global $wgOut, $wgRequest;
$wgOut->setPagetitle( wfMsg( "protectedpages" ) );
$sizetype = $wgRequest->getVal( 'sizetype' );
$size = $wgRequest->getIntOrNull( 'size' );
$NS = $wgRequest->getIntOrNull( 'namespace' );
+ $indefOnly = $wgRequest->getBool( 'indefonly' ) ? 1 : 0;
- $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size );
+ $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly );
- $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size ) );
+ $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly ) );
if ( $pager->getNumRows() ) {
$s = $pager->getNavigationBar();
/**
* Callback function to output a restriction
*/
- function formatRow( $row ) {
+ public function formatRow( $row ) {
global $wgUser, $wgLang, $wgContLang;
wfProfileIn( __METHOD__ );
* @param $type string
* @param $level string
* @param $minsize int
+ * @param $indefOnly bool
* @private
*/
- function showOptions( $namespace, $type='edit', $level, $sizetype, $size ) {
+ protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly ) {
global $wgScript;
$action = htmlspecialchars( $wgScript );
$title = SpecialPage::getTitleFor( 'ProtectedPages' );
Xml::hidden( 'title', $special ) . " \n" .
$this->getNamespaceMenu( $namespace ) . " \n" .
$this->getTypeMenu( $type ) . " \n" .
- $this->getLevelMenu( $level ) . "<br/>\n" .
+ $this->getLevelMenu( $level ) . " \n" .
+ "<span style='white-space: nowrap'>" .
+ $this->getExpiryCheck( $indefOnly ) . "\n" .
$this->getSizeLimit( $sizetype, $size ) . "\n" .
+ "</span>" .
" " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
"</fieldset></form>";
}
* @param mixed $namespace Pre-select namespace
* @return string
*/
- function getNamespaceMenu( $namespace = null ) {
- return Xml::label( wfMsg( 'namespace' ), 'namespace' )
- . ' '
- . Xml::namespaceSelector( $namespace, '' );
+ protected function getNamespaceMenu( $namespace = null ) {
+ return "<span style='white-space: nowrap'>" .
+ Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' '
+ . Xml::namespaceSelector( $namespace, '' ) . "</span>";
+ }
+
+ /**
+ * @return string Formatted HTML
+ */
+ protected function getExpiryCheck( $indefOnly ) {
+ $out = Xml::check( 'indefonly', $indefOnly, array('id' => 'indefonly') ) . ' ';
+ $out .= Xml::label( wfMsg("protectedpages-indef"), 'indefonly' ) . "</p>\n";
+ return $out;
}
/**
* @return string Formatted HTML
- * @private
*/
- function getSizeLimit( $sizetype, $size ) {
+ protected function getSizeLimit( $sizetype, $size ) {
$out = Xml::radio( 'sizetype', 'min', ($sizetype=='min'), array('id' => 'wpmin') );
$out .= Xml::label( wfMsg("minimum-size"), 'wpmin' );
$out .= " ".Xml::radio( 'sizetype', 'max', ($sizetype=='max'), array('id' => 'wpmax') );
/**
* @return string Formatted HTML
- * @private
*/
- function getTypeMenu( $pr_type ) {
+ protected function getTypeMenu( $pr_type ) {
global $wgRestrictionTypes;
$m = array(); // Temporary array
$options[] = Xml::option( $text, $type, $selected ) . "\n";
}
- return
+ return "<span style='white-space: nowrap'>" .
Xml::label( wfMsg('restriction-type') , $this->IdType ) . ' ' .
Xml::tags( 'select',
array( 'id' => $this->IdType, 'name' => $this->IdType ),
- implode( "\n", $options ) );
+ implode( "\n", $options ) ) . "</span>";
}
/**
* @return string Formatted HTML
- * @private
*/
- function getLevelMenu( $pr_level ) {
+ protected function getLevelMenu( $pr_level ) {
global $wgRestrictionLevels;
$m = array( wfMsg('restriction-level-all') => 0 ); // Temporary array
*/
class ProtectedPagesPager extends AlphabeticPager {
public $mForm, $mConds;
+ private $type, $level, $namespace, $sizetype, $size, $indefonly;
- function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0 ) {
+ function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0, $indefonly=false ) {
$this->mForm = $form;
$this->mConds = $conds;
$this->type = ( $type ) ? $type : 'edit';
$this->namespace = $namespace;
$this->sizetype = $sizetype;
$this->size = intval($size);
+ $this->indefonly = (bool)$indefonly;
parent::__construct();
}
$conds[] = 'page_len<=' . $this->size;
}
+ if( $this->indefonly ) {
+ $conds[] = "pr_expiry = 'infinity' OR pr_expiry IS NULL";
+ }
+
if( $this->level )
$conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level );
if( !is_null($this->namespace) )