Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php |
— | — | @@ -55,22 +55,16 @@ |
56 | 56 | $title = SpecialPage::getTitleFor( 'CentralNoticeLogs' ); |
57 | 57 | $fullUrl = wfExpandUrl( $title->getFullUrl(), PROTO_CURRENT ); |
58 | 58 | |
59 | | - $htmlOut .= Xml::radio( |
60 | | - 'log_type', |
61 | | - 'campaign', |
62 | | - ( $this->logType == 'campaignsettings' ? true : false ), |
63 | | - array( 'onclick' => "switchLogs( '".$fullUrl."', 'campaignsettings' )" ) |
64 | | - ); |
65 | | - $htmlOut .= Xml::label( wfMsg( 'centralnotice-campaign-settings' ), 'campaign' ); |
| 59 | + // Build the radio buttons for switching the log type |
| 60 | + $htmlOut .= $this->getLogSwitcher( 'campaignsettings', 'campaignSettings', |
| 61 | + 'centralnotice-campaign-settings', $fullUrl ); |
| 62 | + $htmlOut .= $this->getLogSwitcher( 'bannersettings', 'bannerSettings', |
| 63 | + 'centralnotice-banner-settings', $fullUrl ); |
| 64 | + $htmlOut .= $this->getLogSwitcher( 'bannercontent', 'bannerContent', |
| 65 | + 'centralnotice-banner-content', $fullUrl ); |
| 66 | + $htmlOut .= $this->getLogSwitcher( 'bannermessages', 'bannerMessages', |
| 67 | + 'centralnotice-banner-messages', $fullUrl ); |
66 | 68 | |
67 | | - $htmlOut .= Xml::radio( |
68 | | - 'log_type', |
69 | | - 'banner', |
70 | | - ( $this->logType == 'bannersettings' ? true : false ), |
71 | | - array( 'onclick' => "switchLogs( '".$fullUrl."', 'bannersettings' )" ) |
72 | | - ); |
73 | | - $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-settings' ), 'banner' ); |
74 | | - |
75 | 69 | $htmlOut .= Xml::closeElement( 'div' ); |
76 | 70 | |
77 | 71 | if ( $this->logType == 'campaignsettings' ) { |
— | — | @@ -221,10 +215,16 @@ |
222 | 216 | function showLog( $logType ) { |
223 | 217 | global $wgOut; |
224 | 218 | |
225 | | - if ( $logType == 'bannersettings' ) { |
226 | | - $pager = new CentralNoticeBannerLogPager( $this ); |
227 | | - } else { |
228 | | - $pager = new CentralNoticeLogPager( $this ); |
| 219 | + switch ( $logType ) { |
| 220 | + case 'bannersettings': |
| 221 | + $pager = new CentralNoticeBannerLogPager( $this ); |
| 222 | + break; |
| 223 | + case 'bannercontent': |
| 224 | + case 'bannermessages': |
| 225 | + $pager = new CentralNoticePageLogPager( $this, $logType ); |
| 226 | + break; |
| 227 | + default: |
| 228 | + $pager = new CentralNoticeCampaignLogPager( $this ); |
229 | 229 | } |
230 | 230 | |
231 | 231 | $htmlOut = ''; |
— | — | @@ -247,11 +247,26 @@ |
248 | 248 | $wgOut->addHTML( $htmlOut ); |
249 | 249 | } |
250 | 250 | |
251 | | - private function getDateValue( $type ) { |
| 251 | + static function getDateValue( $type ) { |
252 | 252 | global $wgRequest; |
253 | 253 | $value = $wgRequest->getVal( $type ); |
254 | 254 | if ( $value === 'other' ) $value = null; |
255 | 255 | return $value; |
256 | 256 | } |
| 257 | + |
| 258 | + /** |
| 259 | + * Build a radio button that switches the log type when you click it |
| 260 | + */ |
| 261 | + private function getLogSwitcher( $type, $id, $message, $fullUrl ) { |
| 262 | + $htmlOut = ''; |
| 263 | + $htmlOut .= Xml::radio( |
| 264 | + 'log_type', |
| 265 | + $id, |
| 266 | + ( $this->logType == $type ? true : false ), |
| 267 | + array( 'onclick' => "switchLogs( '".$fullUrl."', '".$type."' )" ) |
| 268 | + ); |
| 269 | + $htmlOut .= Xml::label( wfMsg( $message ), $id ); |
| 270 | + return $htmlOut; |
| 271 | + } |
257 | 272 | |
258 | 273 | } |
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
259 | 274 | Merged /trunk/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php:r95822 |