Index: trunk/phase3/includes/SpecialProtectedpages.php |
— | — | @@ -24,12 +24,13 @@ |
25 | 25 | |
26 | 26 | $type = $wgRequest->getVal( 'type' ); |
27 | 27 | $level = $wgRequest->getVal( 'level' ); |
28 | | - $minsize = $wgRequest->getIntOrNull( 'minsize' ); |
| 28 | + $sizetype = $wgRequest->getVal( 'sizetype' ); |
| 29 | + $size = $wgRequest->getIntOrNull( 'size' ); |
29 | 30 | $NS = $wgRequest->getIntOrNull( 'namespace' ); |
30 | 31 | |
31 | | - $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $minsize ); |
| 32 | + $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size ); |
32 | 33 | |
33 | | - $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $minsize ) ); |
| 34 | + $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size ) ); |
34 | 35 | |
35 | 36 | if ( $pager->getNumRows() ) { |
36 | 37 | $s = $pager->getNavigationBar(); |
— | — | @@ -93,7 +94,7 @@ |
94 | 95 | * @param $minsize int |
95 | 96 | * @private |
96 | 97 | */ |
97 | | - function showOptions( $namespace, $type='edit', $level, $minsize ) { |
| 98 | + function showOptions( $namespace, $type='edit', $level, $sizetype, $size ) { |
98 | 99 | global $wgScript; |
99 | 100 | $action = htmlspecialchars( $wgScript ); |
100 | 101 | $title = SpecialPage::getTitleFor( 'ProtectedPages' ); |
— | — | @@ -101,12 +102,12 @@ |
102 | 103 | return "<form action=\"$action\" method=\"get\">\n" . |
103 | 104 | '<fieldset>' . |
104 | 105 | Xml::element( 'legend', array(), wfMsg( 'protectedpages' ) ) . |
105 | | - Xml::hidden( 'title', $special ) . "\n" . |
106 | | - $this->getNamespaceMenu( $namespace ) . "\n" . |
107 | | - $this->getTypeMenu( $type ) . "\n" . |
| 106 | + Xml::hidden( 'title', $special ) . " \n" . |
| 107 | + $this->getNamespaceMenu( $namespace ) . " \n" . |
| 108 | + $this->getTypeMenu( $type ) . " \n" . |
108 | 109 | $this->getLevelMenu( $level ) . "<br/>\n" . |
109 | | - $this->getSizeLimit( $minsize ) . "\n" . |
110 | | - Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" . |
| 110 | + $this->getSizeLimit( $sizetype, $size ) . "\n" . |
| 111 | + " " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" . |
111 | 112 | "</fieldset></form>"; |
112 | 113 | } |
113 | 114 | |
— | — | @@ -118,9 +119,14 @@ |
119 | 120 | * @return string Formatted HTML |
120 | 121 | * @private |
121 | 122 | */ |
122 | | - function getSizeLimit( $minsize=0 ) { |
123 | | - $out = Xml::input('minsize', 9, $minsize, array( 'id' => 'minsize' ) ); |
124 | | - return "<label for='minsize'>" . wfMsgHtml('minimum-size') . "</label>: " . $out; |
| 123 | + function getSizeLimit( $sizetype, $size ) { |
| 124 | + $out = Xml::radio( 'sizetype', 'min', ($sizetype=='min'), array('id' => 'wpmin') ); |
| 125 | + $out .= Xml::label( wfMsgHtml("minimum-size"), 'wpmin' ); |
| 126 | + $out .= " ".Xml::radio( 'sizetype', 'max', ($sizetype=='max'), array('id' => 'wpmax') ); |
| 127 | + $out .= Xml::label( wfMsgHtml("maximum-size"), 'wpmax' ); |
| 128 | + $out .= " ".Xml::input('size', 9, $size, array( 'id' => 'wpsize' ) ); |
| 129 | + $out .= ' '.wfMsg('pagesize'); |
| 130 | + return $out; |
125 | 131 | } |
126 | 132 | |
127 | 133 | /** |
— | — | @@ -188,16 +194,17 @@ |
189 | 195 | * @todo document |
190 | 196 | * @addtogroup Pager |
191 | 197 | */ |
192 | | -class ProtectedPagesPager extends ReverseChronologicalPager { |
| 198 | +class ProtectedPagesPager extends AlphabeticPager { |
193 | 199 | public $mForm, $mConds; |
194 | 200 | |
195 | | - function __construct( $form, $conds = array(), $type, $level, $namespace, $minsize ) { |
| 201 | + function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0 ) { |
196 | 202 | $this->mForm = $form; |
197 | 203 | $this->mConds = $conds; |
198 | 204 | $this->type = ( $type ) ? $type : 'edit'; |
199 | 205 | $this->level = $level; |
200 | 206 | $this->namespace = $namespace; |
201 | | - $this->minsize = intval($minsize); |
| 207 | + $this->sizetype = $sizetype; |
| 208 | + $this->size = intval($size); |
202 | 209 | parent::__construct(); |
203 | 210 | } |
204 | 211 | |
— | — | @@ -226,17 +233,22 @@ |
227 | 234 | $conds = $this->mConds; |
228 | 235 | $conds[] = 'pr_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() ); |
229 | 236 | $conds[] = 'page_id=pr_page'; |
230 | | - $conds[] = 'page_len>=' . $this->minsize; |
231 | 237 | $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type ); |
232 | | - if ( $this->level ) |
| 238 | + |
| 239 | + if( $this->sizetype=='min' ) |
| 240 | + $conds[] = 'page_len>=' . $this->size; |
| 241 | + else if( $this->sizetype=='max' ) |
| 242 | + $conds[] = 'page_len<=' . $this->size; |
| 243 | + |
| 244 | + if( $this->level ) |
233 | 245 | $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level ); |
234 | | - if ( !is_null($this->namespace) ) |
| 246 | + if( !is_null($this->namespace) ) |
235 | 247 | $conds[] = 'page_namespace=' . $this->mDb->addQuotes( $this->namespace ); |
236 | 248 | return array( |
237 | 249 | 'tables' => array( 'page_restrictions', 'page' ), |
238 | 250 | 'fields' => 'max(pr_id) AS pr_id,page_namespace,page_title,page_len,pr_type,pr_level,pr_expiry', |
239 | 251 | 'conds' => $conds, |
240 | | - 'options' => array( 'GROUP BY' => 'page_namespace,page_title,pr_level,pr_expiry,page_len,pr_type' ), |
| 252 | + 'options' => array( 'GROUP BY' => 'page_namespace,page_title,pr_type' ), |
241 | 253 | ); |
242 | 254 | } |
243 | 255 | |