Index: trunk/phase3/includes/Xml.php |
— | — | @@ -172,6 +172,36 @@ |
173 | 173 | . implode( "\n", $options ) |
174 | 174 | . self::closeElement( 'select' ); |
175 | 175 | } |
| 176 | + |
| 177 | + /** |
| 178 | + * @param $year Integer |
| 179 | + * @param $month Integer |
| 180 | + * @return string Formatted HTML |
| 181 | + */ |
| 182 | + public static function dateMenu( $year, $month ) { |
| 183 | + # Offset overrides year/month selection |
| 184 | + if( $month && $month !== -1 ) { |
| 185 | + $encMonth = intval( $month ); |
| 186 | + } else { |
| 187 | + $encMonth = ''; |
| 188 | + } |
| 189 | + if( $year ) { |
| 190 | + $encYear = intval( $year ); |
| 191 | + } else if( $encMonth ) { |
| 192 | + $thisMonth = intval( gmdate( 'n' ) ); |
| 193 | + $thisYear = intval( gmdate( 'Y' ) ); |
| 194 | + if( intval($encMonth) > $thisMonth ) { |
| 195 | + $thisYear--; |
| 196 | + } |
| 197 | + $encYear = $thisYear; |
| 198 | + } else { |
| 199 | + $encYear = ''; |
| 200 | + } |
| 201 | + return Xml::label( wfMsg( 'year' ), 'year' ) . ' '. |
| 202 | + Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) . ' '. |
| 203 | + Xml::label( wfMsg( 'month' ), 'month' ) . ' '. |
| 204 | + Xml::monthSelector( $encMonth, -1 ); |
| 205 | + } |
176 | 206 | |
177 | 207 | /** |
178 | 208 | * |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -65,10 +65,11 @@ |
66 | 66 | * @param $pattern String |
67 | 67 | * @param $year Integer: year |
68 | 68 | * @param $month Integer: month |
69 | | - * @param $filter Boolean |
| 69 | + * @param $filter: array |
| 70 | + * @param $tagFilter: array? |
70 | 71 | */ |
71 | 72 | public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '', |
72 | | - $month = '', $filter = null, $tagFilter='' ) |
| 73 | + $month = '', $filter = null, $tagFilter='' ) |
73 | 74 | { |
74 | 75 | global $wgScript, $wgMiserMode; |
75 | 76 | $action = htmlspecialchars( $wgScript ); |
— | — | @@ -98,15 +99,17 @@ |
99 | 100 | $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) ); |
100 | 101 | // Option value -> message mapping |
101 | 102 | $links = array(); |
| 103 | + $hiddens = ''; // keep track for "go" button |
102 | 104 | foreach( $filter as $type => $val ) { |
103 | 105 | $hideVal = 1 - intval($val); |
104 | 106 | $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal], |
105 | 107 | wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() ) |
106 | 108 | ); |
107 | 109 | $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link ); |
| 110 | + $hiddens .= Xml::hidden( "hide_{$type}_log", $val ) . "\n"; |
108 | 111 | } |
109 | 112 | // Build links |
110 | | - return $wgLang->pipeList( $links ); |
| 113 | + return '<small>'.$wgLang->pipeList( $links ) . '</small>' . $hiddens; |
111 | 114 | } |
112 | 115 | |
113 | 116 | private function getDefaultQuery() { |
— | — | @@ -183,29 +186,7 @@ |
184 | 187 | * @return string Formatted HTML |
185 | 188 | */ |
186 | 189 | private function getDateMenu( $year, $month ) { |
187 | | - # Offset overrides year/month selection |
188 | | - if( $month && $month !== -1 ) { |
189 | | - $encMonth = intval( $month ); |
190 | | - } else { |
191 | | - $encMonth = ''; |
192 | | - } |
193 | | - if ( $year ) { |
194 | | - $encYear = intval( $year ); |
195 | | - } else if( $encMonth ) { |
196 | | - $thisMonth = intval( gmdate( 'n' ) ); |
197 | | - $thisYear = intval( gmdate( 'Y' ) ); |
198 | | - if( intval($encMonth) > $thisMonth ) { |
199 | | - $thisYear--; |
200 | | - } |
201 | | - $encYear = $thisYear; |
202 | | - } else { |
203 | | - $encYear = ''; |
204 | | - } |
205 | | - return Xml::label( wfMsg( 'year' ), 'year' ) . ' '. |
206 | | - Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) . |
207 | | - ' '. |
208 | | - Xml::label( wfMsg( 'month' ), 'month' ) . ' '. |
209 | | - Xml::monthSelector( $encMonth, -1 ); |
| 190 | + return Xml::dateMenu( $year, $month ); |
210 | 191 | } |
211 | 192 | |
212 | 193 | /** |
— | — | @@ -523,7 +504,7 @@ |
524 | 505 | |
525 | 506 | $this->mLogEventsList = $list; |
526 | 507 | |
527 | | - $this->limitType( $type ); |
| 508 | + $this->limitType( $type ); // excludes hidden types too |
528 | 509 | $this->limitUser( $user ); |
529 | 510 | $this->limitTitle( $title, $pattern ); |
530 | 511 | $this->getDateCond( $year, $month ); |
— | — | @@ -532,10 +513,6 @@ |
533 | 514 | |
534 | 515 | public function getDefaultQuery() { |
535 | 516 | $query = parent::getDefaultQuery(); |
536 | | - $query['type'] = $this->type; |
537 | | - $query['user'] = $this->user; |
538 | | - $query['month'] = $this->mMonth; |
539 | | - $query['year'] = $this->mYear; |
540 | 517 | return $query; |
541 | 518 | } |
542 | 519 | |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -74,27 +74,12 @@ |
75 | 75 | |
76 | 76 | $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev'; |
77 | 77 | # Offset overrides year/month selection |
78 | | - if( ( $month = $wgRequest->getIntOrNull( 'month' ) ) !== null && $month !== -1 ) { |
79 | | - $this->opts['month'] = intval( $month ); |
80 | | - } else { |
81 | | - $this->opts['month'] = ''; |
82 | | - } |
83 | | - if( ( $year = $wgRequest->getIntOrNull( 'year' ) ) !== null ) { |
84 | | - $this->opts['year'] = intval( $year ); |
85 | | - } else if( $this->opts['month'] ) { |
86 | | - $thisMonth = intval( gmdate( 'n' ) ); |
87 | | - $thisYear = intval( gmdate( 'Y' ) ); |
88 | | - if( intval( $this->opts['month'] ) > $thisMonth ) { |
89 | | - $thisYear--; |
90 | | - } |
91 | | - $this->opts['year'] = $thisYear; |
92 | | - } else { |
93 | | - $this->opts['year'] = ''; |
94 | | - } |
95 | | - |
96 | 78 | if( $skip ) { |
97 | 79 | $this->opts['year'] = ''; |
98 | 80 | $this->opts['month'] = ''; |
| 81 | + } else { |
| 82 | + $this->opts['year'] = $wgRequest->getIntOrNull( 'year' ); |
| 83 | + $this->opts['month'] = $wgRequest->getIntOrNull( 'month' ); |
99 | 84 | } |
100 | 85 | |
101 | 86 | // Add RSS/atom links |
— | — | @@ -243,7 +228,7 @@ |
244 | 229 | } |
245 | 230 | |
246 | 231 | $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
247 | | - |
| 232 | + # Add hidden params for tracking |
248 | 233 | foreach ( $this->opts as $name => $value ) { |
249 | 234 | if( in_array( $name, array( 'namespace', 'target', 'contribs', 'year', 'month' ) ) ) { |
250 | 235 | continue; |
— | — | @@ -267,14 +252,8 @@ |
268 | 253 | ( $tagFilter ? Xml::tags( 'p', null, implode( ' ', $tagFilter ) ) : '' ) . |
269 | 254 | Xml::openElement( 'p' ) . |
270 | 255 | '<span style="white-space: nowrap">' . |
271 | | - Xml::label( wfMsg( 'year' ), 'year' ) . ' '. |
272 | | - Xml::input( 'year', 4, $this->opts['year'], array('id' => 'year', 'maxlength' => 4) ) . |
273 | | - '</span>' . |
274 | | - ' '. |
275 | | - '<span style="white-space: nowrap">' . |
276 | | - Xml::label( wfMsg( 'month' ), 'month' ) . ' '. |
277 | | - Xml::monthSelector( $this->opts['month'], -1 ) . ' '. |
278 | | - '</span>' . |
| 256 | + Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . |
| 257 | + '</span>' . ' ' . |
279 | 258 | Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) . |
280 | 259 | Xml::closeElement( 'p' ); |
281 | 260 | |