Index: trunk/extensions/CentralNotice/special/SpecialBannerListLoader.php |
— | — | @@ -9,27 +9,27 @@ |
10 | 10 | public $location; // User country |
11 | 11 | protected $sharedMaxAge = 300; // Cache for 5 minutes on the server side |
12 | 12 | protected $maxAge = 300; // Cache for 5 minutes on the client side |
13 | | - |
| 13 | + |
14 | 14 | function __construct() { |
15 | 15 | // Register special page |
16 | 16 | parent::__construct( "BannerListLoader" ); |
17 | 17 | } |
18 | | - |
| 18 | + |
19 | 19 | function execute( $par ) { |
20 | 20 | global $wgOut, $wgRequest; |
21 | | - |
| 21 | + |
22 | 22 | $wgOut->disable(); |
23 | 23 | $this->sendHeaders(); |
24 | | - |
| 24 | + |
25 | 25 | // Get project language from the query string |
26 | 26 | $this->language = $wgRequest->getText( 'language', 'en' ); |
27 | | - |
| 27 | + |
28 | 28 | // Get project name from the query string |
29 | 29 | $this->project = $wgRequest->getText( 'project', 'wikipedia' ); |
30 | | - |
| 30 | + |
31 | 31 | // Get location from the query string |
32 | 32 | $this->location = $wgRequest->getText( 'country' ); |
33 | | - |
| 33 | + |
34 | 34 | if ( $this->project && $this->language ) { |
35 | 35 | $content = $this->getJsonList(); |
36 | 36 | if ( strlen( $content ) == 0 ) { |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | echo "/* No site specified */"; |
44 | 44 | } |
45 | 45 | } |
46 | | - |
| 46 | + |
47 | 47 | /** |
48 | 48 | * Generate the HTTP response headers for the banner file |
49 | 49 | */ |
— | — | @@ -51,16 +51,16 @@ |
52 | 52 | header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
53 | 53 | header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
54 | 54 | } |
55 | | - |
| 55 | + |
56 | 56 | /** |
57 | 57 | * Generate JSON for the specified site |
58 | 58 | */ |
59 | 59 | function getJsonList() { |
60 | 60 | $banners = array(); |
61 | | - |
| 61 | + |
62 | 62 | // See if we have any preferred campaigns for this language and project |
63 | 63 | $campaigns = CentralNoticeDB::getCampaigns( $this->project, $this->language, null, 1, 1, $this->location ); |
64 | | - |
| 64 | + |
65 | 65 | // Quick short circuit to show preferred campaigns |
66 | 66 | if ( $campaigns ) { |
67 | 67 | // Pull banners |
— | — | @@ -69,11 +69,11 @@ |
70 | 70 | |
71 | 71 | // Didn't find any preferred banners so do an old style lookup |
72 | 72 | if ( !$banners ) { |
73 | | - $banners = CentralNoticeDB::getBannersByTarget( |
| 73 | + $banners = CentralNoticeDB::getBannersByTarget( |
74 | 74 | $this->project, $this->language, $this->location ); |
75 | 75 | } |
76 | | - |
| 76 | + |
77 | 77 | return FormatJson::encode( $banners ); |
78 | 78 | } |
79 | | - |
| 79 | + |
80 | 80 | } |
Index: trunk/extensions/CentralNotice/special/SpecialBannerController.php |
— | — | @@ -14,10 +14,10 @@ |
15 | 15 | |
16 | 16 | function execute( $par ) { |
17 | 17 | global $wgOut; |
18 | | - |
| 18 | + |
19 | 19 | $wgOut->disable(); |
20 | 20 | $this->sendHeaders(); |
21 | | - |
| 21 | + |
22 | 22 | $content = $this->getOutput(); |
23 | 23 | if ( strlen( $content ) == 0 ) { |
24 | 24 | // Hack for IE/Mac 0-length keepalive problem, see RawPage.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | echo $content; |
28 | 28 | } |
29 | 29 | } |
30 | | - |
| 30 | + |
31 | 31 | /** |
32 | 32 | * Generate the HTTP response headers for the banner controller |
33 | 33 | */ |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | */ |
46 | 46 | function getOutput() { |
47 | 47 | global $wgCentralPagePath, $wgContLang; |
48 | | - |
| 48 | + |
49 | 49 | $js = $this->getScriptFunctions() . $this->getToggleScripts(); |
50 | 50 | $js .= <<<JAVASCRIPT |
51 | 51 | ( function( $ ) { |
— | — | @@ -59,19 +59,19 @@ |
60 | 60 | // Store the bannerType in case we need to set a banner hiding cookie later |
61 | 61 | $.centralNotice.data.bannerType = bannerType; |
62 | 62 | // Get the requested banner |
63 | | - var bannerPageQuery = $.param( { |
64 | | - 'banner': bannerName, 'campaign': campaign, 'userlang': wgUserLanguage, |
| 63 | + var bannerPageQuery = $.param( { |
| 64 | + 'banner': bannerName, 'campaign': campaign, 'userlang': wgUserLanguage, |
65 | 65 | 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country |
66 | 66 | } ); |
67 | 67 | var bannerPage = '?title=Special:BannerLoader&' + bannerPageQuery; |
68 | 68 | JAVASCRIPT; |
69 | | - $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"" . |
| 69 | + $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"" . |
70 | 70 | Xml::escapeJsString( $wgCentralPagePath ) . |
71 | 71 | "' + bannerPage + '\"></script>';\n"; |
72 | 72 | $js .= <<<JAVASCRIPT |
73 | 73 | if ( document.cookie.indexOf( 'centralnotice_'+bannerType+'=hide' ) == -1 ) { |
74 | | - jQuery( '#siteNotice' ).prepend( '<div id="centralNotice" class="' + |
75 | | - ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) + |
| 74 | + jQuery( '#siteNotice' ).prepend( '<div id="centralNotice" class="' + |
| 75 | + ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) + |
76 | 76 | ' cn-' + bannerType + '">'+bannerScript+'</div>' ); |
77 | 77 | } |
78 | 78 | }, |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | } |
85 | 85 | var bannerListQuery = $.param( { 'language': wgContentLanguage, 'project': wgNoticeProject, 'country': geoLocation } ); |
86 | 86 | JAVASCRIPT; |
87 | | - $js .= "\n\t\t\t\tvar bannerListURL = wgScript + '?title=' + encodeURIComponent('" . |
| 87 | + $js .= "\n\t\t\t\tvar bannerListURL = wgScript + '?title=' + encodeURIComponent('" . |
88 | 88 | $wgContLang->specialPage( 'BannerListLoader' ) . |
89 | 89 | "') + '&cache=/cn.js&' + bannerListQuery;\n"; |
90 | 90 | $js .= <<<JAVASCRIPT |
— | — | @@ -96,16 +96,16 @@ |
97 | 97 | 'chooseBanner': function( bannerList ) { |
98 | 98 | // Convert the json object to a true array |
99 | 99 | bannerList = Array.prototype.slice.call( bannerList ); |
100 | | - |
| 100 | + |
101 | 101 | // Make sure there are some banners to choose from |
102 | 102 | if ( bannerList.length == 0 ) return false; |
103 | | - |
| 103 | + |
104 | 104 | var groomedBannerList = []; |
105 | | - |
| 105 | + |
106 | 106 | for( var i = 0; i < bannerList.length; i++ ) { |
107 | 107 | // Only include this banner if it's intended for the current user |
108 | | - if( ( wgUserName && bannerList[i].display_account ) || |
109 | | - ( !wgUserName && bannerList[i].display_anon == 1 ) ) |
| 108 | + if( ( wgUserName && bannerList[i].display_account ) || |
| 109 | + ( !wgUserName && bannerList[i].display_anon == 1 ) ) |
110 | 110 | { |
111 | 111 | // add the banner to our list once per weight |
112 | 112 | for( var j=0; j < bannerList[i].weight; j++ ) { |
— | — | @@ -113,15 +113,15 @@ |
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | | - |
| 117 | + |
118 | 118 | // Return if there's nothing left after the grooming |
119 | 119 | if( groomedBannerList.length == 0 ) return false; |
120 | | - |
| 120 | + |
121 | 121 | // Choose a random key |
122 | 122 | var pointer = Math.floor( Math.random() * groomedBannerList.length ); |
123 | | - |
| 123 | + |
124 | 124 | // Load a random banner from our groomed list |
125 | | - $.centralNotice.fn.loadBanner( |
| 125 | + $.centralNotice.fn.loadBanner( |
126 | 126 | groomedBannerList[pointer].name, |
127 | 127 | groomedBannerList[pointer].campaign, |
128 | 128 | ( groomedBannerList[pointer].fundraising ? 'fundraising' : 'default' ) |
— | — | @@ -151,9 +151,9 @@ |
152 | 152 | } )( jQuery ); |
153 | 153 | JAVASCRIPT; |
154 | 154 | return $js; |
155 | | - |
| 155 | + |
156 | 156 | } |
157 | | - |
| 157 | + |
158 | 158 | function getToggleScripts() { |
159 | 159 | $script = "var wgNoticeToggleState = (document.cookie.indexOf('hidesnmessage=1')==-1);\n\n"; |
160 | 160 | return $script; |
— | — | @@ -166,7 +166,7 @@ |
167 | 167 | jQuery( 'div#centralNotice' ).prepend( bannerJson.bannerHtml ); |
168 | 168 | if ( bannerJson.autolink ) { |
169 | 169 | JAVASCRIPT; |
170 | | - $script .= "\n\t\tvar url = '" . |
| 170 | + $script .= "\n\t\tvar url = '" . |
171 | 171 | Xml::escapeJsString( $wgNoticeFundraisingUrl ) . "';\n"; |
172 | 172 | $script .= <<<JAVASCRIPT |
173 | 173 | if ( ( bannerJson.landingPages !== null ) && bannerJson.landingPages.length ) { |
— | — | @@ -175,8 +175,8 @@ |
176 | 176 | 'landing_page': targets[Math.floor( Math.random() * targets.length )].replace( /^\s+|\s+$/, '' ) |
177 | 177 | } ); |
178 | 178 | url += "&" + jQuery.param( { |
179 | | - 'utm_medium': 'sitenotice', 'utm_campaign': bannerJson.campaign, |
180 | | - 'utm_source': bannerJson.bannerName, 'language': wgUserLanguage, |
| 179 | + 'utm_medium': 'sitenotice', 'utm_campaign': bannerJson.campaign, |
| 180 | + 'utm_source': bannerJson.bannerName, 'language': wgUserLanguage, |
181 | 181 | 'country': Geo.country |
182 | 182 | } ); |
183 | 183 | jQuery( '#cn-landingpage-link' ).attr( 'href', url ); |
Index: trunk/extensions/CentralNotice/special/SpecialCentralNotice.php |
— | — | @@ -51,8 +51,8 @@ |
52 | 52 | // Handle form submissions from "Manage campaigns" or "Add a campaign" interface |
53 | 53 | if ( $this->editable && $wgRequest->wasPosted() ) { |
54 | 54 | |
55 | | - // Check authentication token |
56 | | - if ( $wgUser->matchEditToken( $wgRequest->getVal( 'authtoken' ) ) ) { |
| 55 | + // Check authentication token |
| 56 | + if ( $wgUser->matchEditToken( $wgRequest->getVal( 'authtoken' ) ) ) { |
57 | 57 | |
58 | 58 | // Handle adding a campaign |
59 | 59 | if ( $method == 'addCampaign' ) { |
— | — | @@ -1385,7 +1385,7 @@ |
1386 | 1386 | $startDate = $dbr->timestamp( $start ); |
1387 | 1387 | $endDate = $dbr->timestamp( $end ); |
1388 | 1388 | |
1389 | | - $dbw = wfGetDB( DB_MASTER ); |
| 1389 | + $dbw = wfGetDB( DB_MASTER ); |
1390 | 1390 | $res = $dbw->update( 'cn_notices', |
1391 | 1391 | array( |
1392 | 1392 | 'not_start' => $startDate, |
— | — | @@ -1419,8 +1419,8 @@ |
1420 | 1420 | $dbw = wfGetDB( DB_MASTER ); |
1421 | 1421 | $noticeId = CentralNotice::getNoticeId( $noticeName ); |
1422 | 1422 | $dbw->update( 'cn_assignments', |
1423 | | - array ( 'tmp_weight' => $weight ), |
1424 | | - array( |
| 1423 | + array ( 'tmp_weight' => $weight ), |
| 1424 | + array( |
1425 | 1425 | 'tmp_id' => $templateId, |
1426 | 1426 | 'not_id' => $noticeId |
1427 | 1427 | ) |
Index: trunk/extensions/CentralNotice/special/SpecialBannerAllocation.php |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | $accountWeight = 0; |
169 | 169 | |
170 | 170 | if ( $banners ) { |
171 | | - |
| 171 | + |
172 | 172 | foreach ( $banners as $banner ) { |
173 | 173 | if ( $banner['display_anon'] ) { |
174 | 174 | $anonBanners[] = $banner; |
— | — | @@ -178,12 +178,12 @@ |
179 | 179 | $accountBanners[] = $banner; |
180 | 180 | $accountWeight += $banner['weight']; |
181 | 181 | } |
182 | | - |
| 182 | + |
183 | 183 | if ( $banner['campaign'] ) { |
184 | 184 | $campaigns[] = "'".$banner['campaign']."'"; |
185 | 185 | } |
186 | 186 | } |
187 | | - |
| 187 | + |
188 | 188 | // Build campaign list for bannerstats.js |
189 | 189 | $campaignList = implode( ', ', $campaigns ); |
190 | 190 | $js = "wgCentralNoticeAllocationCampaigns = array( $campaignList );"; |
— | — | @@ -234,10 +234,10 @@ |
235 | 235 | |
236 | 236 | $htmlOut .= wfMsg ( 'percent', $wgLang->formatNum( $percentage ) ); |
237 | 237 | $htmlOut .= Html::closeElement( 'td' ); |
238 | | - |
| 238 | + |
239 | 239 | $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top' ) ); |
240 | 240 | // The span class is used by bannerstats.js to find where to insert the stats |
241 | | - $htmlOut .= Html::openElement( 'span', |
| 241 | + $htmlOut .= Html::openElement( 'span', |
242 | 242 | array( 'class' => 'cn-'.$banner['campaign'].'-'.$banner['name'] ) ); |
243 | 243 | $htmlOut .= $sk->makeLinkObj( $viewBanner, htmlspecialchars( $banner['name'] ), |
244 | 244 | 'template=' . urlencode( $banner['name'] ) ); |
Index: trunk/extensions/CentralNotice/special/SpecialBannerLoader.php |
— | — | @@ -8,23 +8,23 @@ |
9 | 9 | public $language = 'en'; // User language |
10 | 10 | protected $sharedMaxAge = 600; // Cache for 10 minutes on the server side |
11 | 11 | protected $maxAge = 0; // No client-side banner caching so we get all impressions |
12 | | - |
| 12 | + |
13 | 13 | function __construct() { |
14 | 14 | // Register special page |
15 | 15 | parent::__construct( "BannerLoader" ); |
16 | 16 | } |
17 | | - |
| 17 | + |
18 | 18 | function execute( $par ) { |
19 | 19 | global $wgOut, $wgRequest; |
20 | | - |
| 20 | + |
21 | 21 | $wgOut->disable(); |
22 | 22 | $this->sendHeaders(); |
23 | | - |
| 23 | + |
24 | 24 | // Get values from the query string |
25 | 25 | $this->language = $wgRequest->getText( 'userlang', 'en' ); |
26 | 26 | $this->siteName = $wgRequest->getText( 'sitename', 'Wikipedia' ); |
27 | 27 | $this->campaign = $wgRequest->getText( 'campaign', 'undefined' ); |
28 | | - |
| 28 | + |
29 | 29 | if ( $wgRequest->getText( 'banner' ) ) { |
30 | 30 | $bannerName = $wgRequest->getText( 'banner' ); |
31 | 31 | try { |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | echo "/* No banner specified */"; |
46 | 46 | } |
47 | 47 | } |
48 | | - |
| 48 | + |
49 | 49 | /** |
50 | 50 | * Generate the HTTP response headers for the banner file |
51 | 51 | */ |
— | — | @@ -53,10 +53,10 @@ |
54 | 54 | header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
55 | 55 | header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
56 | 56 | } |
57 | | - |
| 57 | + |
58 | 58 | /** |
59 | 59 | * Generate the JS for the requested banner |
60 | | - * @return a string of Javascript containing a call to insertBanner() |
| 60 | + * @return a string of Javascript containing a call to insertBanner() |
61 | 61 | * with JSON containing the banner content as the parameter |
62 | 62 | * @throws SpecialBannerLoaderException |
63 | 63 | */ |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | return $bannerJs; |
84 | 84 | } |
85 | 85 | } |
86 | | - |
| 86 | + |
87 | 87 | /** |
88 | 88 | * Generate the HTML for the requested banner |
89 | 89 | * @throws SpecialBannerLoaderException |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | $count = intval( $counter_value ); |
186 | 186 | if ( !$count ) { |
187 | 187 | // Pull long-cached amount |
188 | | - $count = intval( $wgMemc->get( |
| 188 | + $count = intval( $wgMemc->get( |
189 | 189 | wfMemcKey( 'centralnotice', 'counter', 'fallback' ) ) ); |
190 | 190 | if ( !$count ) { |
191 | 191 | throw new DonationAmountUnknownException(); |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | } |
199 | 199 | return $count; |
200 | 200 | } |
201 | | - |
| 201 | + |
202 | 202 | function getFundraising( $bannerName ) { |
203 | 203 | global $wgCentralDBname; |
204 | 204 | $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | $row = $dbr->selectRow( 'cn_templates', 'tmp_fundraising', array( 'tmp_name' => $eBannerName ) ); |
207 | 207 | return $row->tmp_fundraising; |
208 | 208 | } |
209 | | - |
| 209 | + |
210 | 210 | function getAutolink( $bannerName ) { |
211 | 211 | global $wgCentralDBname; |
212 | 212 | $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
— | — | @@ -213,7 +213,7 @@ |
214 | 214 | $row = $dbr->selectRow( 'cn_templates', 'tmp_autolink', array( 'tmp_name' => $eBannerName ) ); |
215 | 215 | return $row->tmp_autolink; |
216 | 216 | } |
217 | | - |
| 217 | + |
218 | 218 | function getLandingPages( $bannerName ) { |
219 | 219 | global $wgCentralDBname; |
220 | 220 | $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
— | — | @@ -231,7 +231,7 @@ |
232 | 232 | * |
233 | 233 | * This exception is being thrown whenever |
234 | 234 | * some fatal error occurs that may affect |
235 | | - * how the banner is presented. |
| 235 | + * how the banner is presented. |
236 | 236 | * |
237 | 237 | * @ingroup Exception |
238 | 238 | */ |
Index: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php |
— | — | @@ -7,12 +7,12 @@ |
8 | 8 | |
9 | 9 | class SpecialNoticeTemplate extends UnlistedSpecialPage { |
10 | 10 | var $editable, $centralNoticeError; |
11 | | - |
| 11 | + |
12 | 12 | function __construct() { |
13 | 13 | // Register special page |
14 | 14 | parent::__construct( 'NoticeTemplate' ); |
15 | 15 | } |
16 | | - |
| 16 | + |
17 | 17 | /** |
18 | 18 | * Handle different types of page requests |
19 | 19 | */ |
— | — | @@ -21,13 +21,13 @@ |
22 | 22 | |
23 | 23 | // Begin output |
24 | 24 | $this->setHeaders(); |
25 | | - |
| 25 | + |
26 | 26 | // Output ResourceLoader module for styling and javascript functions |
27 | 27 | $wgOut->addModules( 'ext.centralNotice.interface' ); |
28 | 28 | |
29 | 29 | // Check permissions |
30 | 30 | $this->editable = $wgUser->isAllowed( 'centralnotice-admin' ); |
31 | | - |
| 31 | + |
32 | 32 | // Initialize error variable |
33 | 33 | $this->centralNoticeError = false; |
34 | 34 | |
— | — | @@ -39,12 +39,12 @@ |
40 | 40 | |
41 | 41 | // Begin Banners tab content |
42 | 42 | $wgOut->addHTML( Html::openElement( 'div', array( 'id' => 'preferences' ) ) ); |
43 | | - |
| 43 | + |
44 | 44 | $method = $wgRequest->getVal( 'wpMethod' ); |
45 | | - |
| 45 | + |
46 | 46 | // Handle form submissions |
47 | 47 | if ( $this->editable && $wgRequest->wasPosted() ) { |
48 | | - |
| 48 | + |
49 | 49 | // Check authentication token |
50 | 50 | if ( $wgUser->matchEditToken( $wgRequest->getVal( 'authtoken' ) ) ) { |
51 | 51 | |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | $this->showError( 'centralnotice-null-string' ); |
91 | 91 | } |
92 | 92 | } |
93 | | - |
| 93 | + |
94 | 94 | // Handle editing banner |
95 | 95 | if ( $method == 'editTemplate' ) { |
96 | 96 | $this->editTemplate( |
— | — | @@ -103,11 +103,11 @@ |
104 | 104 | ); |
105 | 105 | $sub = 'view'; |
106 | 106 | } |
107 | | - |
| 107 | + |
108 | 108 | } else { |
109 | 109 | $this->showError( 'sessionfailure' ); |
110 | 110 | } |
111 | | - |
| 111 | + |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Handle viewing of a banner in all languages |
— | — | @@ -132,36 +132,36 @@ |
133 | 133 | $wgOut->addHTML( Html::closeElement( 'div' ) ); |
134 | 134 | return; |
135 | 135 | } |
136 | | - |
| 136 | + |
137 | 137 | // Handle cloning a specific banner |
138 | 138 | if ( $sub == 'clone' ) { |
139 | | - |
| 139 | + |
140 | 140 | // Check authentication token |
141 | 141 | if ( $wgUser->matchEditToken( $wgRequest->getVal( 'authtoken' ) ) ) { |
142 | | - |
| 142 | + |
143 | 143 | $oldTemplate = $wgRequest->getVal( 'oldTemplate' ); |
144 | 144 | $newTemplate = $wgRequest->getVal( 'newTemplate' ); |
145 | 145 | // We use the returned name in case any special characters had to be removed |
146 | 146 | $template = $this->cloneTemplate( $oldTemplate, $newTemplate ); |
147 | | - $wgOut->redirect( |
| 147 | + $wgOut->redirect( |
148 | 148 | $this->getTitle( 'view' )->getLocalUrl( "template=$template" ) ); |
149 | 149 | return; |
150 | | - |
| 150 | + |
151 | 151 | } else { |
152 | 152 | $this->showError( 'sessionfailure' ); |
153 | 153 | } |
154 | | - |
| 154 | + |
155 | 155 | } |
156 | | - |
| 156 | + |
157 | 157 | } |
158 | 158 | |
159 | 159 | // Show list of banners by default |
160 | 160 | $this->showList(); |
161 | | - |
| 161 | + |
162 | 162 | // End Banners tab content |
163 | 163 | $wgOut->addHTML( Html::closeElement( 'div' ) ); |
164 | 164 | } |
165 | | - |
| 165 | + |
166 | 166 | /** |
167 | 167 | * Show a list of available banners. Newer banners are shown first. |
168 | 168 | */ |
— | — | @@ -170,13 +170,13 @@ |
171 | 171 | |
172 | 172 | $sk = $wgUser->getSkin(); |
173 | 173 | $pager = new TemplatePager( $this ); |
174 | | - |
| 174 | + |
175 | 175 | // Begin building HTML |
176 | 176 | $htmlOut = ''; |
177 | | - |
| 177 | + |
178 | 178 | // Begin Manage Banners fieldset |
179 | 179 | $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
180 | | - |
| 180 | + |
181 | 181 | if ( !$pager->getNumRows() ) { |
182 | 182 | $htmlOut .= Html::element( 'p', null, wfMsg( 'centralnotice-no-templates' ) ); |
183 | 183 | } else { |
— | — | @@ -184,14 +184,14 @@ |
185 | 185 | $htmlOut .= Html::openElement( 'form', array( 'method' => 'post' ) ); |
186 | 186 | } |
187 | 187 | $htmlOut .= Html::element( 'h2', null, wfMsg( 'centralnotice-manage-templates' ) ); |
188 | | - |
| 188 | + |
189 | 189 | // Show paginated list of banners |
190 | | - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), |
| 190 | + $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), |
191 | 191 | $pager->getNavigationBar() ); |
192 | 192 | $htmlOut .= $pager->getBody(); |
193 | | - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), |
| 193 | + $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), |
194 | 194 | $pager->getNavigationBar() ); |
195 | | - |
| 195 | + |
196 | 196 | if ( $this->editable ) { |
197 | 197 | $htmlOut .= Html::closeElement( 'form' ); |
198 | 198 | } |
— | — | @@ -202,29 +202,29 @@ |
203 | 203 | $newPage = $this->getTitle( 'add' ); |
204 | 204 | $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) ); |
205 | 205 | } |
206 | | - |
| 206 | + |
207 | 207 | // End Manage Banners fieldset |
208 | 208 | $htmlOut .= Html::closeElement( 'fieldset' ); |
209 | 209 | |
210 | 210 | $wgOut->addHTML( $htmlOut ); |
211 | 211 | } |
212 | | - |
| 212 | + |
213 | 213 | /** |
214 | 214 | * Show "Add a banner" interface |
215 | 215 | */ |
216 | 216 | function showAdd() { |
217 | | - global $wgOut, $wgUser, $wgExtensionAssetsPath, $wgLang, $wgRequest, |
| 217 | + global $wgOut, $wgUser, $wgExtensionAssetsPath, $wgLang, $wgRequest, |
218 | 218 | $wgNoticeEnableFundraising; |
219 | 219 | $scriptPath = "$wgExtensionAssetsPath/CentralNotice"; |
220 | 220 | |
221 | 221 | // Build HTML |
222 | 222 | $htmlOut = ''; |
223 | 223 | $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
224 | | - $htmlOut .= Html::openElement( 'form', |
| 224 | + $htmlOut .= Html::openElement( 'form', |
225 | 225 | array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) ); |
226 | 226 | $htmlOut .= Html::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) ); |
227 | 227 | $htmlOut .= Html::hidden( 'wpMethod', 'addTemplate' ); |
228 | | - |
| 228 | + |
229 | 229 | // If there was an error, we'll need to restore the state of the form |
230 | 230 | if ( $wgRequest->wasPosted() ) { |
231 | 231 | $templateName = $wgRequest->getVal( 'templateName' ); |
— | — | @@ -243,93 +243,93 @@ |
244 | 244 | $landingPages = ''; |
245 | 245 | $body = ''; |
246 | 246 | } |
247 | | - |
| 247 | + |
248 | 248 | $htmlOut .= Xml::tags( 'p', null, |
249 | | - Xml::inputLabel( |
250 | | - wfMsg( 'centralnotice-banner-name' ), |
251 | | - 'templateName', 'templateName', 25, $templateName |
| 249 | + Xml::inputLabel( |
| 250 | + wfMsg( 'centralnotice-banner-name' ), |
| 251 | + 'templateName', 'templateName', 25, $templateName |
252 | 252 | ) |
253 | 253 | ); |
254 | | - |
| 254 | + |
255 | 255 | // Display settings |
256 | 256 | $htmlOut .= Html::openElement( 'p', null ); |
257 | 257 | $htmlOut .= wfMsg( 'centralnotice-banner-display' ); |
258 | 258 | $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 'id' => 'displayAnon' ) ); |
259 | 259 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' ); |
260 | | - $htmlOut .= Xml::check( 'displayAccount', $displayAccount, |
| 260 | + $htmlOut .= Xml::check( 'displayAccount', $displayAccount, |
261 | 261 | array( 'id' => 'displayAccount' ) ); |
262 | 262 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' ); |
263 | 263 | $htmlOut .= Html::closeElement( 'p' ); |
264 | | - |
| 264 | + |
265 | 265 | // Fundraising settings |
266 | 266 | if ( $wgNoticeEnableFundraising ) { |
267 | | - |
| 267 | + |
268 | 268 | // Checkbox for indicating if it is a fundraising banner |
269 | 269 | $htmlOut .= Html::openElement( 'p', null ); |
270 | 270 | $htmlOut .= Xml::check( 'fundraising', $fundraising, array( 'id' => 'fundraising' ) ); |
271 | 271 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), 'fundraising' ); |
272 | 272 | $htmlOut .= Html::closeElement( 'p' ); |
273 | | - |
| 273 | + |
274 | 274 | // Checkbox for whether or not to automatically create landing page link |
275 | 275 | $htmlOut .= Html::openElement( 'p', null ); |
276 | 276 | $htmlOut .= Xml::check( 'autolink', $autolink, array( 'id' => 'autolink' ) ); |
277 | 277 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-autolink' ), 'autolink' ); |
278 | 278 | $htmlOut .= Html::closeElement( 'p' ); |
279 | | - |
| 279 | + |
280 | 280 | // Interface for setting the landing pages |
281 | | - $htmlOut .= Html::openElement( 'div', |
| 281 | + $htmlOut .= Html::openElement( 'div', |
282 | 282 | array( 'id' => 'autolinkInterface', 'style' => 'display: none;' ) ); |
283 | | - $htmlOut .= Xml::tags( 'p', array(), |
| 283 | + $htmlOut .= Xml::tags( 'p', array(), |
284 | 284 | wfMsg( 'centralnotice-banner-autolink-help', 'id="cn-landingpage-link"', 'JimmyAppeal01' ) ); |
285 | 285 | $htmlOut .= Xml::tags( 'p', array(), |
286 | | - Xml::inputLabel( |
287 | | - wfMsg( 'centralnotice-banner-landing-pages' ), |
288 | | - 'landingPages', 'landingPages', 40, $landingPages, |
| 286 | + Xml::inputLabel( |
| 287 | + wfMsg( 'centralnotice-banner-landing-pages' ), |
| 288 | + 'landingPages', 'landingPages', 40, $landingPages, |
289 | 289 | array( 'maxlength' => 255 ) |
290 | 290 | ) |
291 | 291 | ); |
292 | 292 | $htmlOut .= Html::closeElement( 'div' ); |
293 | 293 | } |
294 | | - |
| 294 | + |
295 | 295 | // Begin banner body section |
296 | 296 | $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) ); |
297 | 297 | $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' ); |
298 | 298 | $buttons = array(); |
299 | | - $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . |
| 299 | + $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . |
300 | 300 | wfMsg( 'centralnotice-close-button' ) . '</a>'; |
301 | 301 | $htmlOut .= Xml::tags( 'div', |
302 | 302 | array( 'style' => 'margin-bottom: 0.2em;' ), |
303 | | - '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . |
| 303 | + '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . |
304 | 304 | wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) ) |
305 | 305 | ); |
306 | | - |
| 306 | + |
307 | 307 | $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20 ); |
308 | 308 | $htmlOut .= Html::closeElement( 'fieldset' ); |
309 | 309 | $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
310 | | - |
| 310 | + |
311 | 311 | // Submit button |
312 | | - $htmlOut .= Xml::tags( 'div', |
313 | | - array( 'class' => 'cn-buttons' ), |
314 | | - Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) ) |
| 312 | + $htmlOut .= Xml::tags( 'div', |
| 313 | + array( 'class' => 'cn-buttons' ), |
| 314 | + Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) ) |
315 | 315 | ); |
316 | | - |
| 316 | + |
317 | 317 | $htmlOut .= Html::closeElement( 'form' ); |
318 | 318 | $htmlOut .= Html::closeElement( 'fieldset' ); |
319 | 319 | |
320 | 320 | // Output HTML |
321 | 321 | $wgOut->addHTML( $htmlOut ); |
322 | 322 | } |
323 | | - |
| 323 | + |
324 | 324 | /** |
325 | 325 | * View or edit an individual banner |
326 | 326 | */ |
327 | 327 | private function showView() { |
328 | | - global $wgOut, $wgUser, $wgRequest, $wgLanguageCode, $wgExtensionAssetsPath, $wgLang, |
| 328 | + global $wgOut, $wgUser, $wgRequest, $wgLanguageCode, $wgExtensionAssetsPath, $wgLang, |
329 | 329 | $wgNoticeEnableFundraising; |
330 | | - |
| 330 | + |
331 | 331 | $scriptPath = "$wgExtensionAssetsPath/CentralNotice"; |
332 | 332 | $sk = $wgUser->getSkin(); |
333 | | - |
| 333 | + |
334 | 334 | if ( $this->editable ) { |
335 | 335 | $readonly = array(); |
336 | 336 | $disabled = array(); |
— | — | @@ -343,22 +343,22 @@ |
344 | 344 | |
345 | 345 | // Get current banner |
346 | 346 | $currentTemplate = $wgRequest->getText( 'template' ); |
347 | | - |
| 347 | + |
348 | 348 | $bannerSettings = CentralNoticeDB::getBannerSettings( $currentTemplate ); |
349 | | - |
| 349 | + |
350 | 350 | if ( !$bannerSettings ) { |
351 | 351 | $this->showError( 'centralnotice-banner-doesnt-exist' ); |
352 | 352 | return; |
353 | 353 | } else { |
354 | 354 | // Begin building HTML |
355 | 355 | $htmlOut = ''; |
356 | | - |
| 356 | + |
357 | 357 | // Begin View Banner fieldset |
358 | 358 | $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
359 | | - |
360 | | - $htmlOut .= Html::element( 'h2', null, |
| 359 | + |
| 360 | + $htmlOut .= Html::element( 'h2', null, |
361 | 361 | wfMsg( 'centralnotice-banner-heading', $currentTemplate ) ); |
362 | | - |
| 362 | + |
363 | 363 | // Show preview of banner |
364 | 364 | $render = new SpecialBannerLoader(); |
365 | 365 | $render->siteName = 'Wikipedia'; |
— | — | @@ -369,7 +369,7 @@ |
370 | 370 | $preview = wfMsg( 'centralnotice-nopreview' ); |
371 | 371 | } |
372 | 372 | if ( $render->language != '' ) { |
373 | | - $htmlOut .= Xml::fieldset( |
| 373 | + $htmlOut .= Xml::fieldset( |
374 | 374 | wfMsg( 'centralnotice-preview' ) . " ($render->language)", |
375 | 375 | $preview |
376 | 376 | ); |
— | — | @@ -378,18 +378,18 @@ |
379 | 379 | $preview |
380 | 380 | ); |
381 | 381 | } |
382 | | - |
| 382 | + |
383 | 383 | // Pull banner text and respect any inc: markup |
384 | | - $bodyPage = Title::newFromText( |
| 384 | + $bodyPage = Title::newFromText( |
385 | 385 | "Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI ); |
386 | 386 | $curRev = Revision::newFromTitle( $bodyPage ); |
387 | 387 | $body = $curRev ? $curRev->getText() : ''; |
388 | | - |
| 388 | + |
389 | 389 | // Extract message fields from the banner body |
390 | 390 | $fields = array(); |
391 | 391 | $allowedChars = Title::legalChars(); |
392 | 392 | preg_match_all( "/\{\{\{([$allowedChars]+)\}\}\}/u", $body, $fields ); |
393 | | - |
| 393 | + |
394 | 394 | // If there are any message fields in the banner, display translation tools. |
395 | 395 | if ( count( $fields[0] ) > 0 ) { |
396 | 396 | if ( $this->editable ) { |
— | — | @@ -406,49 +406,49 @@ |
407 | 407 | 'width' => '100%' |
408 | 408 | ) |
409 | 409 | ); |
410 | | - |
| 410 | + |
411 | 411 | // Table headers |
412 | | - $htmlOut .= Html::element( 'th', array( 'width' => '15%' ), |
| 412 | + $htmlOut .= Html::element( 'th', array( 'width' => '15%' ), |
413 | 413 | wfMsg( 'centralnotice-message' ) ); |
414 | | - $htmlOut .= Html::element( 'th', array( 'width' => '5%' ), |
| 414 | + $htmlOut .= Html::element( 'th', array( 'width' => '5%' ), |
415 | 415 | wfMsg ( 'centralnotice-number-uses' ) ); |
416 | | - $htmlOut .= Html::element( 'th', array( 'width' => '40%' ), |
| 416 | + $htmlOut .= Html::element( 'th', array( 'width' => '40%' ), |
417 | 417 | wfMsg ( 'centralnotice-english' ) ); |
418 | 418 | $languages = Language::getLanguageNames(); |
419 | | - $htmlOut .= Html::element( 'th', array( 'width' => '40%' ), |
| 419 | + $htmlOut .= Html::element( 'th', array( 'width' => '40%' ), |
420 | 420 | $languages[$wpUserLang] ); |
421 | | - |
| 421 | + |
422 | 422 | // Remove duplicate message fields |
423 | 423 | $filteredFields = array(); |
424 | 424 | foreach ( $fields[1] as $field ) { |
425 | | - $filteredFields[$field] = array_key_exists( $field, $filteredFields ) |
| 425 | + $filteredFields[$field] = array_key_exists( $field, $filteredFields ) |
426 | 426 | ? $filteredFields[$field] + 1 : 1; |
427 | 427 | } |
428 | | - |
| 428 | + |
429 | 429 | // Table rows |
430 | 430 | foreach ( $filteredFields as $field => $count ) { |
431 | 431 | // Message |
432 | | - $message = ( $wpUserLang == 'en' ) |
433 | | - ? "Centralnotice-{$currentTemplate}-{$field}" |
| 432 | + $message = ( $wpUserLang == 'en' ) |
| 433 | + ? "Centralnotice-{$currentTemplate}-{$field}" |
434 | 434 | : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}"; |
435 | | - |
| 435 | + |
436 | 436 | // English value |
437 | 437 | $htmlOut .= Html::openElement( 'tr' ); |
438 | | - |
| 438 | + |
439 | 439 | $title = Title::newFromText( "MediaWiki:{$message}" ); |
440 | 440 | $htmlOut .= Xml::tags( 'td', null, |
441 | 441 | $sk->makeLinkObj( $title, htmlspecialchars( $field ) ) |
442 | 442 | ); |
443 | | - |
| 443 | + |
444 | 444 | $htmlOut .= Html::element( 'td', null, $count ); |
445 | | - |
| 445 | + |
446 | 446 | // English text |
447 | 447 | $englishText = wfMsg( 'centralnotice-message-not-set' ); |
448 | 448 | $englishTextExists = false; |
449 | | - if ( |
450 | | - Title::newFromText( |
451 | | - "Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI |
452 | | - )->exists() ) |
| 449 | + if ( |
| 450 | + Title::newFromText( |
| 451 | + "Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI |
| 452 | + )->exists() ) |
453 | 453 | { |
454 | 454 | $englishText = wfMsgExt( "Centralnotice-{$currentTemplate}-{$field}", |
455 | 455 | array( 'language' => 'en' ) |
— | — | @@ -457,14 +457,14 @@ |
458 | 458 | } |
459 | 459 | $htmlOut .= Xml::tags( 'td', null, |
460 | 460 | Html::element( 'span', |
461 | | - array( |
462 | | - 'style' => 'font-style:italic;' . |
463 | | - ( !$englishTextExists ? 'color:silver' : '' ) |
| 461 | + array( |
| 462 | + 'style' => 'font-style:italic;' . |
| 463 | + ( !$englishTextExists ? 'color:silver' : '' ) |
464 | 464 | ), |
465 | 465 | $englishText |
466 | 466 | ) |
467 | 467 | ); |
468 | | - |
| 468 | + |
469 | 469 | // Foreign text input |
470 | 470 | $foreignText = ''; |
471 | 471 | $foreignTextExists = false; |
— | — | @@ -475,37 +475,37 @@ |
476 | 476 | $foreignTextExists = true; |
477 | 477 | } |
478 | 478 | $htmlOut .= Xml::tags( 'td', null, |
479 | | - Xml::input( |
480 | | - "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", |
481 | | - '', |
| 479 | + Xml::input( |
| 480 | + "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", |
| 481 | + '', |
482 | 482 | $foreignText, |
483 | 483 | wfArrayMerge( $readonly, |
484 | | - array( 'style' => 'width:100%;' . |
| 484 | + array( 'style' => 'width:100%;' . |
485 | 485 | ( !$foreignTextExists ? 'color:red' : '' ) ) ) |
486 | 486 | ) |
487 | 487 | ); |
488 | 488 | $htmlOut .= Html::closeElement( 'tr' ); |
489 | 489 | } |
490 | 490 | $htmlOut .= Html::closeElement( 'table' ); |
491 | | - |
| 491 | + |
492 | 492 | if ( $this->editable ) { |
493 | 493 | $htmlOut .= Html::hidden( 'wpUserLanguage', $wpUserLang ); |
494 | 494 | $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
495 | 495 | $htmlOut .= Xml::tags( 'div', |
496 | | - array( 'class' => 'cn-buttons' ), |
497 | | - Xml::submitButton( |
498 | | - wfMsg( 'centralnotice-modify' ), |
499 | | - array( 'name' => 'update' ) |
500 | | - ) |
| 496 | + array( 'class' => 'cn-buttons' ), |
| 497 | + Xml::submitButton( |
| 498 | + wfMsg( 'centralnotice-modify' ), |
| 499 | + array( 'name' => 'update' ) |
| 500 | + ) |
501 | 501 | ); |
502 | 502 | } |
503 | | - |
| 503 | + |
504 | 504 | $htmlOut .= Html::closeElement( 'fieldset' ); |
505 | | - |
| 505 | + |
506 | 506 | if ( $this->editable ) { |
507 | 507 | $htmlOut .= Html::closeElement( 'form' ); |
508 | 508 | } |
509 | | - |
| 509 | + |
510 | 510 | // Show language selection form |
511 | 511 | $actionTitle = $this->getTitleFor( 'NoticeTemplate', 'view' ); |
512 | 512 | $actionUrl = $actionTitle->getLocalURL(); |
— | — | @@ -514,9 +514,9 @@ |
515 | 515 | $htmlOut .= Html::hidden( 'template', $currentTemplate ); |
516 | 516 | $htmlOut .= Html::openElement( 'table', array ( 'cellpadding' => 9 ) ); |
517 | 517 | list( $lsLabel, $lsSelect ) = Xml::languageSelector( $wpUserLang ); |
518 | | - |
| 518 | + |
519 | 519 | $newPage = $this->getTitle( 'view' ); |
520 | | - |
| 520 | + |
521 | 521 | $htmlOut .= Xml::tags( 'tr', null, |
522 | 522 | Xml::tags( 'td', null, $lsLabel ) . |
523 | 523 | Xml::tags( 'td', null, $lsSelect ) . |
— | — | @@ -526,29 +526,29 @@ |
527 | 527 | ); |
528 | 528 | $htmlOut .= Xml::tags( 'tr', null, |
529 | 529 | Xml::tags( 'td', null, '' ) . |
530 | | - Xml::tags( 'td', null, |
531 | | - $sk->makeLinkObj( |
532 | | - $newPage, |
533 | | - wfMsgHtml( 'centralnotice-preview-all-template-translations' ), |
534 | | - "template=$currentTemplate&wpUserLanguage=all" ) |
| 530 | + Xml::tags( 'td', null, |
| 531 | + $sk->makeLinkObj( |
| 532 | + $newPage, |
| 533 | + wfMsgHtml( 'centralnotice-preview-all-template-translations' ), |
| 534 | + "template=$currentTemplate&wpUserLanguage=all" ) |
535 | 535 | ) |
536 | 536 | ); |
537 | 537 | $htmlOut .= Html::closeElement( 'table' ); |
538 | 538 | $htmlOut .= Html::closeElement( 'fieldset' ); |
539 | 539 | $htmlOut .= Html::closeElement( 'form' ); |
540 | 540 | } |
541 | | - |
| 541 | + |
542 | 542 | // Show edit form |
543 | 543 | if ( $this->editable ) { |
544 | | - $htmlOut .= Html::openElement( 'form', |
545 | | - array( |
546 | | - 'method' => 'post', |
547 | | - 'onsubmit' => 'return validateBannerForm(this)' |
548 | | - ) |
| 544 | + $htmlOut .= Html::openElement( 'form', |
| 545 | + array( |
| 546 | + 'method' => 'post', |
| 547 | + 'onsubmit' => 'return validateBannerForm(this)' |
| 548 | + ) |
549 | 549 | ); |
550 | 550 | $htmlOut .= Html::hidden( 'wpMethod', 'editTemplate' ); |
551 | 551 | } |
552 | | - |
| 552 | + |
553 | 553 | // If there was an error, we'll need to restore the state of the form |
554 | 554 | if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'mainform' ) ) { |
555 | 555 | $displayAnon = $wgRequest->getCheck( 'displayAnon' ); |
— | — | @@ -565,56 +565,56 @@ |
566 | 566 | $landingPages = $bannerSettings['landingpages']; |
567 | 567 | // $body default is defined prior to message interface code |
568 | 568 | } |
569 | | - |
| 569 | + |
570 | 570 | // Show banner settings |
571 | 571 | $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-settings' ) ); |
572 | 572 | $htmlOut .= Html::openElement( 'p', null ); |
573 | 573 | $htmlOut .= wfMsg( 'centralnotice-banner-display' ); |
574 | | - $htmlOut .= Xml::check( 'displayAnon', $displayAnon, |
| 574 | + $htmlOut .= Xml::check( 'displayAnon', $displayAnon, |
575 | 575 | wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) ); |
576 | 576 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' ); |
577 | | - $htmlOut .= Xml::check( 'displayAccount', $displayAccount, |
| 577 | + $htmlOut .= Xml::check( 'displayAccount', $displayAccount, |
578 | 578 | wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) ); |
579 | 579 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' ); |
580 | 580 | $htmlOut .= Html::closeElement( 'p' ); |
581 | | - |
| 581 | + |
582 | 582 | // Fundraising settings |
583 | 583 | if ( $wgNoticeEnableFundraising ) { |
584 | | - |
| 584 | + |
585 | 585 | // Checkbox for indicating if it is a fundraising banner |
586 | 586 | $htmlOut .= Html::openElement( 'p', null ); |
587 | | - $htmlOut .= Xml::check( 'fundraising', $fundraising, |
| 587 | + $htmlOut .= Xml::check( 'fundraising', $fundraising, |
588 | 588 | wfArrayMerge( $disabled, array( 'id' => 'fundraising' ) ) ); |
589 | | - $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), |
| 589 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), |
590 | 590 | 'fundraising' ); |
591 | 591 | $htmlOut .= Html::closeElement( 'p' ); |
592 | | - |
| 592 | + |
593 | 593 | // Checkbox for whether or not to automatically create landing page link |
594 | 594 | $htmlOut .= Html::openElement( 'p', null ); |
595 | | - $htmlOut .= Xml::check( 'autolink', $autolink, |
| 595 | + $htmlOut .= Xml::check( 'autolink', $autolink, |
596 | 596 | wfArrayMerge( $disabled, array( 'id' => 'autolink' ) ) ); |
597 | | - $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-autolink' ), |
| 597 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-autolink' ), |
598 | 598 | 'autolink' ); |
599 | 599 | $htmlOut .= Html::closeElement( 'p' ); |
600 | | - |
| 600 | + |
601 | 601 | // Interface for setting the landing pages |
602 | 602 | if ( $autolink ) { |
603 | 603 | $htmlOut .= Html::openElement( 'div', array( 'id'=>'autolinkInterface' ) ); |
604 | 604 | } else { |
605 | | - $htmlOut .= Html::openElement( 'div', |
| 605 | + $htmlOut .= Html::openElement( 'div', |
606 | 606 | array( 'id'=>'autolinkInterface', 'style'=>'display:none;' ) ); |
607 | 607 | } |
608 | | - $htmlOut .= Xml::tags( 'p', array(), |
| 608 | + $htmlOut .= Xml::tags( 'p', array(), |
609 | 609 | wfMsg( 'centralnotice-banner-autolink-help', 'id="cn-landingpage-link"', 'JimmyAppeal01' ) ); |
610 | 610 | $htmlOut .= Xml::tags( 'p', array(), |
611 | | - Xml::inputLabel( |
612 | | - wfMsg( 'centralnotice-banner-landing-pages' ), |
613 | | - 'landingPages', 'landingPages', 40, $landingPages, |
| 611 | + Xml::inputLabel( |
| 612 | + wfMsg( 'centralnotice-banner-landing-pages' ), |
| 613 | + 'landingPages', 'landingPages', 40, $landingPages, |
614 | 614 | array( 'maxlength' => 255 ) |
615 | 615 | ) |
616 | 616 | ); |
617 | 617 | $htmlOut .= Html::closeElement( 'div' ); |
618 | | - |
| 618 | + |
619 | 619 | } |
620 | 620 | |
621 | 621 | // Begin banner body section |
— | — | @@ -623,12 +623,12 @@ |
624 | 624 | $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-edit-template' ) ); |
625 | 625 | $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' ); |
626 | 626 | $buttons = array(); |
627 | | - $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . |
| 627 | + $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . |
628 | 628 | wfMsg( 'centralnotice-close-button' ) . '</a>'; |
629 | 629 | $htmlOut .= Xml::tags( 'div', |
630 | 630 | array( 'style' => 'margin-bottom: 0.2em;' ), |
631 | | - '<img src="' . $scriptPath . '/down-arrow.png" ' . |
632 | | - 'style="vertical-align:baseline;"/>' . |
| 631 | + '<img src="' . $scriptPath . '/down-arrow.png" ' . |
| 632 | + 'style="vertical-align:baseline;"/>' . |
633 | 633 | wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) ) |
634 | 634 | ); |
635 | 635 | } else { |
— | — | @@ -640,13 +640,13 @@ |
641 | 641 | // Indicate which form was submitted |
642 | 642 | $htmlOut .= Html::hidden( 'mainform', 'true' ); |
643 | 643 | $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
644 | | - $htmlOut .= Xml::tags( 'div', |
645 | | - array( 'class' => 'cn-buttons' ), |
646 | | - Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) ) |
| 644 | + $htmlOut .= Xml::tags( 'div', |
| 645 | + array( 'class' => 'cn-buttons' ), |
| 646 | + Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) ) |
647 | 647 | ); |
648 | 648 | $htmlOut .= Html::closeElement( 'form' ); |
649 | 649 | } |
650 | | - |
| 650 | + |
651 | 651 | // Show clone form |
652 | 652 | if ( $this->editable ) { |
653 | 653 | $htmlOut .= Html::openElement ( 'form', |
— | — | @@ -655,33 +655,33 @@ |
656 | 656 | 'action' => $this->getTitle( 'clone' )->getLocalUrl() |
657 | 657 | ) |
658 | 658 | ); |
659 | | - |
| 659 | + |
660 | 660 | $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-clone-notice' ) ); |
661 | 661 | $htmlOut .= Html::openElement( 'table', array( 'cellpadding' => 9 ) ); |
662 | 662 | $htmlOut .= Html::openElement( 'tr' ); |
663 | | - $htmlOut .= Xml::inputLabel( |
664 | | - wfMsg( 'centralnotice-clone-name' ), |
| 663 | + $htmlOut .= Xml::inputLabel( |
| 664 | + wfMsg( 'centralnotice-clone-name' ), |
665 | 665 | 'newTemplate', 'newTemplate', '25' ); |
666 | | - $htmlOut .= Xml::submitButton( |
667 | | - wfMsg( 'centralnotice-clone' ), |
| 666 | + $htmlOut .= Xml::submitButton( |
| 667 | + wfMsg( 'centralnotice-clone' ), |
668 | 668 | array ( 'id' => 'clone' ) ); |
669 | 669 | $htmlOut .= Html::hidden( 'oldTemplate', $currentTemplate ); |
670 | | - |
| 670 | + |
671 | 671 | $htmlOut .= Html::closeElement( 'tr' ); |
672 | 672 | $htmlOut .= Html::closeElement( 'table' ); |
673 | 673 | $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
674 | 674 | $htmlOut .= Html::closeElement( 'fieldset' ); |
675 | 675 | $htmlOut .= Html::closeElement( 'form' ); |
676 | 676 | } |
677 | | - |
| 677 | + |
678 | 678 | // End View Banner fieldset |
679 | 679 | $htmlOut .= Html::closeElement( 'fieldset' ); |
680 | | - |
| 680 | + |
681 | 681 | // Output HTML |
682 | 682 | $wgOut->addHTML( $htmlOut ); |
683 | 683 | } |
684 | 684 | } |
685 | | - |
| 685 | + |
686 | 686 | /** |
687 | 687 | * Preview all available translations of a banner |
688 | 688 | */ |
— | — | @@ -696,10 +696,10 @@ |
697 | 697 | // Pull all available text for a banner |
698 | 698 | $langs = array_keys( $this->getTranslations( $template ) ); |
699 | 699 | $htmlOut = ''; |
700 | | - |
| 700 | + |
701 | 701 | // Begin View Banner fieldset |
702 | 702 | $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
703 | | - |
| 703 | + |
704 | 704 | $htmlOut .= Html::element( 'h2', null, wfMsg( 'centralnotice-banner-heading', $template ) ); |
705 | 705 | |
706 | 706 | foreach ( $langs as $lang ) { |
— | — | @@ -723,13 +723,13 @@ |
724 | 724 | ) |
725 | 725 | ); |
726 | 726 | } |
727 | | - |
| 727 | + |
728 | 728 | // End View Banner fieldset |
729 | 729 | $htmlOut .= Html::closeElement( 'fieldset' ); |
730 | | - |
| 730 | + |
731 | 731 | return $wgOut->addHtml( $htmlOut ); |
732 | 732 | } |
733 | | - |
| 733 | + |
734 | 734 | /** |
735 | 735 | * Add or update a message |
736 | 736 | */ |
— | — | @@ -741,7 +741,7 @@ |
742 | 742 | $article = new Article( $title ); |
743 | 743 | $article->doEdit( $translation, '', EDIT_FORCE_BOT ); |
744 | 744 | } |
745 | | - |
| 745 | + |
746 | 746 | private static function getTemplateId ( $templateName ) { |
747 | 747 | $dbr = wfGetDB( DB_SLAVE ); |
748 | 748 | $res = $dbr->select( 'cn_templates', 'tmp_id', |
— | — | @@ -755,7 +755,7 @@ |
756 | 756 | } |
757 | 757 | return null; |
758 | 758 | } |
759 | | - |
| 759 | + |
760 | 760 | public static function getBannerName( $bannerId ) { |
761 | 761 | $dbr = wfGetDB( DB_MASTER ); |
762 | 762 | if ( is_numeric( $bannerId ) ) { |
— | — | @@ -778,7 +778,7 @@ |
779 | 779 | } else { |
780 | 780 | // Log the removal of the banner |
781 | 781 | $this->logBannerChange( 'removed', $id ); |
782 | | - |
| 782 | + |
783 | 783 | $dbw = wfGetDB( DB_MASTER ); |
784 | 784 | $dbw->begin(); |
785 | 785 | $dbw->delete( 'cn_templates', |
— | — | @@ -805,9 +805,9 @@ |
806 | 806 | * @param $landingPages string list of landing pages (optional) |
807 | 807 | * @return true or false depending on whether banner was successfully added |
808 | 808 | */ |
809 | | - public function addTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising = 0, |
| 809 | + public function addTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising = 0, |
810 | 810 | $autolink = 0, $landingPages = '' ) { |
811 | | - |
| 811 | + |
812 | 812 | if ( $body == '' || $name == '' ) { |
813 | 813 | $this->showError( 'centralnotice-null-string' ); |
814 | 814 | return false; |
— | — | @@ -847,7 +847,7 @@ |
848 | 848 | Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI ) |
849 | 849 | ); |
850 | 850 | $article->doEdit( $body, '', EDIT_FORCE_BOT ); |
851 | | - |
| 851 | + |
852 | 852 | // Log the creation of the banner |
853 | 853 | $beginSettings = array(); |
854 | 854 | $endSettings = array( |
— | — | @@ -858,7 +858,7 @@ |
859 | 859 | 'landingpages' => $landingPages |
860 | 860 | ); |
861 | 861 | $this->logBannerChange( 'created', $bannerId, $beginSettings, $endSettings ); |
862 | | - |
| 862 | + |
863 | 863 | return true; |
864 | 864 | } |
865 | 865 | } |
— | — | @@ -866,14 +866,14 @@ |
867 | 867 | /** |
868 | 868 | * Update a banner |
869 | 869 | */ |
870 | | - private function editTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising, |
| 870 | + private function editTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising, |
871 | 871 | $autolink, $landingPages ) { |
872 | | - |
| 872 | + |
873 | 873 | if ( $body == '' || $name == '' ) { |
874 | 874 | $this->showError( 'centralnotice-null-string' ); |
875 | 875 | return; |
876 | 876 | } |
877 | | - |
| 877 | + |
878 | 878 | $initialBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
879 | 879 | |
880 | 880 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -894,7 +894,7 @@ |
895 | 895 | ), |
896 | 896 | array( 'tmp_name' => $name ) |
897 | 897 | ); |
898 | | - |
| 898 | + |
899 | 899 | // Perhaps these should move into the db as blob |
900 | 900 | $article = new Article( |
901 | 901 | Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI ) |
— | — | @@ -904,13 +904,13 @@ |
905 | 905 | |
906 | 906 | $bannerId = SpecialNoticeTemplate::getTemplateId( $name ); |
907 | 907 | $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
908 | | - |
| 908 | + |
909 | 909 | // If there are any difference between the old settings and the new settings, log them. |
910 | 910 | $diffs = array_diff_assoc( $initialBannerSettings, $finalBannerSettings ); |
911 | 911 | if ( $diffs ) { |
912 | 912 | $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings ); |
913 | 913 | } |
914 | | - |
| 914 | + |
915 | 915 | return; |
916 | 916 | } |
917 | 917 | } |
— | — | @@ -919,16 +919,16 @@ |
920 | 920 | * Copy all the data from one banner to another |
921 | 921 | */ |
922 | 922 | public function cloneTemplate( $source, $dest ) { |
923 | | - |
| 923 | + |
924 | 924 | // Reset the timer as updates on meta take a long time |
925 | 925 | set_time_limit( 300 ); |
926 | | - |
| 926 | + |
927 | 927 | // Pull all possible langs |
928 | 928 | $langs = $this->getTranslations( $source ); |
929 | 929 | |
930 | 930 | // Normalize name |
931 | 931 | $dest = preg_replace( '/[^A-Za-z0-9_]/', '', $dest ); |
932 | | - |
| 932 | + |
933 | 933 | // Pull banner settings from database |
934 | 934 | $dbr = wfGetDB( DB_SLAVE ); |
935 | 935 | $row = $dbr->selectRow( 'cn_templates', |
— | — | @@ -980,8 +980,8 @@ |
981 | 981 | // Remove duplicates |
982 | 982 | $filteredFields = array(); |
983 | 983 | foreach ( $fields[1] as $field ) { |
984 | | - $filteredFields[$field] = array_key_exists( $field, $filteredFields ) |
985 | | - ? $filteredFields[$field] + 1 |
| 984 | + $filteredFields[$field] = array_key_exists( $field, $filteredFields ) |
| 985 | + ? $filteredFields[$field] + 1 |
986 | 986 | : 1; |
987 | 987 | } |
988 | 988 | return $filteredFields; |
— | — | @@ -1005,8 +1005,8 @@ |
1006 | 1006 | // Iterate through all possible message fields |
1007 | 1007 | foreach ( $fields as $field => $count ) { |
1008 | 1008 | // Put all message fields together for a lookup |
1009 | | - $message = ( $lang == 'en' ) |
1010 | | - ? "Centralnotice-{$template}-{$field}" |
| 1009 | + $message = ( $lang == 'en' ) |
| 1010 | + ? "Centralnotice-{$template}-{$field}" |
1011 | 1011 | : "Centralnotice-{$template}-{$field}/{$lang}"; |
1012 | 1012 | if ( Title::newFromText( $message, NS_MEDIAWIKI )->exists() ) { |
1013 | 1013 | $translations[$lang][$field] = wfMsgExt( |
— | — | @@ -1018,13 +1018,13 @@ |
1019 | 1019 | } |
1020 | 1020 | return $translations; |
1021 | 1021 | } |
1022 | | - |
| 1022 | + |
1023 | 1023 | function showError( $message ) { |
1024 | 1024 | global $wgOut; |
1025 | 1025 | $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", $message ); |
1026 | 1026 | $this->centralNoticeError = true; |
1027 | 1027 | } |
1028 | | - |
| 1028 | + |
1029 | 1029 | /** |
1030 | 1030 | * Log setting changes related to a banner |
1031 | 1031 | * @param $action string: 'created', 'modified', or 'removed' |
— | — | @@ -1034,9 +1034,9 @@ |
1035 | 1035 | */ |
1036 | 1036 | function logBannerChange( $action, $bannerId, $beginSettings = array(), $endSettings = array() ) { |
1037 | 1037 | global $wgUser; |
1038 | | - |
| 1038 | + |
1039 | 1039 | $dbw = wfGetDB( DB_MASTER ); |
1040 | | - |
| 1040 | + |
1041 | 1041 | $log = array( |
1042 | 1042 | 'tmplog_timestamp' => $dbw->timestamp(), |
1043 | 1043 | 'tmplog_user_id' => $wgUser->getId(), |
— | — | @@ -1044,14 +1044,14 @@ |
1045 | 1045 | 'tmplog_template_id' => $bannerId, |
1046 | 1046 | 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId ) |
1047 | 1047 | ); |
1048 | | - |
| 1048 | + |
1049 | 1049 | foreach ( $beginSettings as $key => $value ) { |
1050 | 1050 | $log['tmplog_begin_'.$key] = $value; |
1051 | 1051 | } |
1052 | 1052 | foreach ( $endSettings as $key => $value ) { |
1053 | 1053 | $log['tmplog_end_'.$key] = $value; |
1054 | 1054 | } |
1055 | | - |
| 1055 | + |
1056 | 1056 | $res = $dbw->insert( 'cn_template_log', $log ); |
1057 | 1057 | $log_id = $dbw->insertId(); |
1058 | 1058 | return $log_id; |
Index: trunk/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php |
— | — | @@ -7,23 +7,23 @@ |
8 | 8 | |
9 | 9 | class SpecialCentralNoticeLogs extends UnlistedSpecialPage { |
10 | 10 | public $logType = 'campaignsettings'; |
11 | | - |
| 11 | + |
12 | 12 | function __construct() { |
13 | 13 | // Register special page |
14 | 14 | parent::__construct( "CentralNoticeLogs" ); |
15 | 15 | } |
16 | | - |
| 16 | + |
17 | 17 | /** |
18 | 18 | * Handle different types of page requests |
19 | 19 | */ |
20 | 20 | function execute( $sub ) { |
21 | 21 | global $wgOut, $wgRequest, $wgExtensionAssetsPath; |
22 | | - |
| 22 | + |
23 | 23 | $this->logType = $wgRequest->getText( 'log', 'campaignsettings' ); |
24 | 24 | |
25 | 25 | // Begin output |
26 | 26 | $this->setHeaders(); |
27 | | - |
| 27 | + |
28 | 28 | // Output ResourceLoader module for styling and javascript functions |
29 | 29 | $wgOut->addModules( 'ext.centralNotice.interface' ); |
30 | 30 | |
— | — | @@ -38,12 +38,12 @@ |
39 | 39 | |
40 | 40 | // Begin Banners tab content |
41 | 41 | $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'preferences' ) ) ); |
42 | | - |
| 42 | + |
43 | 43 | $htmlOut = ''; |
44 | | - |
| 44 | + |
45 | 45 | // Begin log selection fieldset |
46 | 46 | $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
47 | | - |
| 47 | + |
48 | 48 | $title = SpecialPage::getTitleFor( 'CentralNoticeLogs' ); |
49 | 49 | $actionUrl = $title->getLocalURL(); |
50 | 50 | $htmlOut .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $actionUrl ) ); |
— | — | @@ -51,21 +51,21 @@ |
52 | 52 | $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-switcher' ) ); |
53 | 53 | $title = SpecialPage::getTitleFor( 'CentralNoticeLogs' ); |
54 | 54 | $fullUrl = wfExpandUrl( $title->getFullUrl(), PROTO_CURRENT ); |
55 | | - |
| 55 | + |
56 | 56 | // Build the radio buttons for switching the log type |
57 | | - $htmlOut .= $this->getLogSwitcher( 'campaignsettings', 'campaignSettings', |
| 57 | + $htmlOut .= $this->getLogSwitcher( 'campaignsettings', 'campaignSettings', |
58 | 58 | 'centralnotice-campaign-settings', $fullUrl ); |
59 | | - $htmlOut .= $this->getLogSwitcher( 'bannersettings', 'bannerSettings', |
| 59 | + $htmlOut .= $this->getLogSwitcher( 'bannersettings', 'bannerSettings', |
60 | 60 | 'centralnotice-banner-settings', $fullUrl ); |
61 | | - $htmlOut .= $this->getLogSwitcher( 'bannercontent', 'bannerContent', |
| 61 | + $htmlOut .= $this->getLogSwitcher( 'bannercontent', 'bannerContent', |
62 | 62 | 'centralnotice-banner-content', $fullUrl ); |
63 | | - $htmlOut .= $this->getLogSwitcher( 'bannermessages', 'bannerMessages', |
| 63 | + $htmlOut .= $this->getLogSwitcher( 'bannermessages', 'bannerMessages', |
64 | 64 | 'centralnotice-banner-messages', $fullUrl ); |
65 | | - |
| 65 | + |
66 | 66 | $htmlOut .= Xml::closeElement( 'div' ); |
67 | | - |
| 67 | + |
68 | 68 | if ( $this->logType == 'campaignsettings' ) { |
69 | | - |
| 69 | + |
70 | 70 | $reset = $wgRequest->getVal( 'centralnoticelogreset' ); |
71 | 71 | $campaign = $wgRequest->getVal( 'campaign' ); |
72 | 72 | $user = $wgRequest->getVal( 'user' ); |
— | — | @@ -75,9 +75,9 @@ |
76 | 76 | $endYear = $this->getDateValue( 'end_year' ); |
77 | 77 | $endMonth = $this->getDateValue( 'end_month' ); |
78 | 78 | $endDay = $this->getDateValue( 'end_day' ); |
79 | | - |
| 79 | + |
80 | 80 | $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-filters-container' ) ); |
81 | | - |
| 81 | + |
82 | 82 | if ( $campaign || $user || $startYear || $startMonth || $startDay || $endYear || $endMonth || $endDay ) { // filters on |
83 | 83 | $htmlOut .= '<a href="javascript:toggleFilterDisplay()">'. |
84 | 84 | '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/collapsed.png" id="cn-collapsed-filter-arrow" style="display:none;position:relative;top:-2px;"/>'. |
— | — | @@ -93,10 +93,10 @@ |
94 | 94 | $htmlOut .= Xml::tags( 'span', array( 'style' => 'margin-left: 0.3em;' ), 'Log filters' ); |
95 | 95 | $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-filters', 'style' => 'display:none;' ) ); |
96 | 96 | } |
97 | | - |
| 97 | + |
98 | 98 | $htmlOut .= Xml::openElement( 'table' ); |
99 | 99 | $htmlOut .= Xml::openElement( 'tr' ); |
100 | | - |
| 100 | + |
101 | 101 | $htmlOut .= Xml::openElement( 'td' ); |
102 | 102 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-start-date' ), 'month', array( 'class' => 'cn-log-filter-label' ) ); |
103 | 103 | $htmlOut .= Xml::closeElement( 'td' ); |
— | — | @@ -107,10 +107,10 @@ |
108 | 108 | $htmlOut .= $this->dateSelector( 'start', $startYear, $startMonth, $startDay ); |
109 | 109 | } |
110 | 110 | $htmlOut .= Xml::closeElement( 'td' ); |
111 | | - |
| 111 | + |
112 | 112 | $htmlOut .= Xml::closeElement( 'tr' ); |
113 | 113 | $htmlOut .= Xml::openElement( 'tr' ); |
114 | | - |
| 114 | + |
115 | 115 | $htmlOut .= Xml::openElement( 'td' ); |
116 | 116 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-end-date' ), 'month', array( 'class' => 'cn-log-filter-label' ) ); |
117 | 117 | $htmlOut .= Xml::closeElement( 'td' ); |
— | — | @@ -121,10 +121,10 @@ |
122 | 122 | $htmlOut .= $this->dateSelector( 'end', $endYear, $endMonth, $endDay ); |
123 | 123 | } |
124 | 124 | $htmlOut .= Xml::closeElement( 'td' ); |
125 | | - |
| 125 | + |
126 | 126 | $htmlOut .= Xml::closeElement( 'tr' ); |
127 | 127 | $htmlOut .= Xml::openElement( 'tr' ); |
128 | | - |
| 128 | + |
129 | 129 | $htmlOut .= Xml::openElement( 'td' ); |
130 | 130 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-notice' ), 'campaign', array( 'class' => 'cn-log-filter-label' ) ); |
131 | 131 | $htmlOut .= Xml::closeElement( 'td' ); |
— | — | @@ -132,10 +132,10 @@ |
133 | 133 | $htmlOut .= Xml::input( 'campaign', 25, ( $reset ? '' : $campaign ) ); |
134 | 134 | $htmlOut .= Xml::closeElement( 'span' ); |
135 | 135 | $htmlOut .= Xml::closeElement( 'td' ); |
136 | | - |
| 136 | + |
137 | 137 | $htmlOut .= Xml::closeElement( 'tr' ); |
138 | 138 | $htmlOut .= Xml::openElement( 'tr' ); |
139 | | - |
| 139 | + |
140 | 140 | $htmlOut .= Xml::openElement( 'td' ); |
141 | 141 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-user' ), 'user', array( 'class' => 'cn-log-filter-label' ) ); |
142 | 142 | $htmlOut .= Xml::closeElement( 'td' ); |
— | — | @@ -143,10 +143,10 @@ |
144 | 144 | $htmlOut .= Xml::input( 'user', 25, ( $reset ? '' : $user ) ); |
145 | 145 | $htmlOut .= Xml::closeElement( 'span' ); |
146 | 146 | $htmlOut .= Xml::closeElement( 'td' ); |
147 | | - |
| 147 | + |
148 | 148 | $htmlOut .= Xml::closeElement( 'tr' ); |
149 | 149 | $htmlOut .= Xml::openElement( 'tr' ); |
150 | | - |
| 150 | + |
151 | 151 | $htmlOut .= Xml::openElement( 'td', array( 'colspan' => 2 ) ); |
152 | 152 | $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-apply-filters' ), |
153 | 153 | array( |
— | — | @@ -165,26 +165,26 @@ |
166 | 166 | ) |
167 | 167 | ); |
168 | 168 | $htmlOut .= Xml::closeElement( 'td' ); |
169 | | - |
| 169 | + |
170 | 170 | $htmlOut .= Xml::closeElement( 'tr' ); |
171 | 171 | $htmlOut .= Xml::closeElement( 'table' ); |
172 | 172 | $htmlOut .= Xml::closeElement( 'div' ); |
173 | 173 | $htmlOut .= Xml::closeElement( 'div' ); |
174 | 174 | } |
175 | | - |
| 175 | + |
176 | 176 | $htmlOut .= Xml::closeElement( 'form' ); |
177 | | - |
| 177 | + |
178 | 178 | // End log selection fieldset |
179 | 179 | //$htmlOut .= Xml::closeElement( 'fieldset' ); |
180 | 180 | |
181 | 181 | $wgOut->addHTML( $htmlOut ); |
182 | | - |
| 182 | + |
183 | 183 | $this->showLog( $this->logType ); |
184 | 184 | |
185 | 185 | // End Banners tab content |
186 | 186 | $wgOut->addHTML( Xml::closeElement( 'div' ) ); |
187 | 187 | } |
188 | | - |
| 188 | + |
189 | 189 | private function dateSelector( $prefix, $year = 0, $month = 0, $day = 0 ) { |
190 | 190 | $dateRanges = CentralNotice::getDateRanges(); |
191 | 191 | |
— | — | @@ -204,14 +204,14 @@ |
205 | 205 | } |
206 | 206 | return $out; |
207 | 207 | } |
208 | | - |
| 208 | + |
209 | 209 | /** |
210 | 210 | * Show a log of changes. |
211 | 211 | * @param $logType string: which type of log to show |
212 | 212 | */ |
213 | 213 | function showLog( $logType ) { |
214 | 214 | global $wgOut; |
215 | | - |
| 215 | + |
216 | 216 | switch ( $logType ) { |
217 | 217 | case 'bannersettings': |
218 | 218 | $pager = new CentralNoticeBannerLogPager( $this ); |
— | — | @@ -223,34 +223,34 @@ |
224 | 224 | default: |
225 | 225 | $pager = new CentralNoticeCampaignLogPager( $this ); |
226 | 226 | } |
227 | | - |
| 227 | + |
228 | 228 | $htmlOut = ''; |
229 | | - |
| 229 | + |
230 | 230 | // Begin log fieldset |
231 | 231 | //$htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
232 | | - |
| 232 | + |
233 | 233 | // Show paginated list of log entries |
234 | | - $htmlOut .= Xml::tags( 'div', |
235 | | - array( 'class' => 'cn-pager' ), |
| 234 | + $htmlOut .= Xml::tags( 'div', |
| 235 | + array( 'class' => 'cn-pager' ), |
236 | 236 | $pager->getNavigationBar() ); |
237 | 237 | $htmlOut .= $pager->getBody(); |
238 | | - $htmlOut .= Xml::tags( 'div', |
239 | | - array( 'class' => 'cn-pager' ), |
| 238 | + $htmlOut .= Xml::tags( 'div', |
| 239 | + array( 'class' => 'cn-pager' ), |
240 | 240 | $pager->getNavigationBar() ); |
241 | | - |
| 241 | + |
242 | 242 | // End log fieldset |
243 | 243 | $htmlOut .= Xml::closeElement( 'fieldset' ); |
244 | 244 | |
245 | 245 | $wgOut->addHTML( $htmlOut ); |
246 | 246 | } |
247 | | - |
| 247 | + |
248 | 248 | static function getDateValue( $type ) { |
249 | 249 | global $wgRequest; |
250 | 250 | $value = $wgRequest->getVal( $type ); |
251 | 251 | if ( $value === 'other' ) $value = null; |
252 | 252 | return $value; |
253 | 253 | } |
254 | | - |
| 254 | + |
255 | 255 | /** |
256 | 256 | * Build a radio button that switches the log type when you click it |
257 | 257 | */ |
Index: trunk/extensions/CentralNotice/special/SpecialHideBanners.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Unlisted Special Page which sets a cookie for hiding banners across all languages of a project. |
10 | | - * This is typically used on donation thank-you pages so that users who have donated will no longer |
| 10 | + * This is typically used on donation thank-you pages so that users who have donated will no longer |
11 | 11 | * see fundrasing banners. |
12 | 12 | */ |
13 | 13 | class SpecialHideBanners extends UnlistedSpecialPage { |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | |
18 | 18 | function execute( $par ) { |
19 | 19 | global $wgOut; |
20 | | - |
| 20 | + |
21 | 21 | $this->setHideCookie(); |
22 | 22 | |
23 | 23 | $wgOut->disable(); |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | |
29 | 29 | readfile( dirname( __FILE__ ) . '/../1x1.png' ); |
30 | 30 | } |
31 | | - |
| 31 | + |
32 | 32 | /** |
33 | 33 | * Set the cookie for hiding fundraising banners. |
34 | 34 | */ |
Index: trunk/extensions/CentralNotice/TemplatePager.php |
— | — | @@ -8,16 +8,16 @@ |
9 | 9 | $this->special = $special; |
10 | 10 | $this->editable = $special->editable; |
11 | 11 | parent::__construct(); |
12 | | - |
| 12 | + |
13 | 13 | // Override paging defaults |
14 | 14 | list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset( 20, '' ); |
15 | 15 | $this->mLimitsShown = array( 20, 50, 100 ); |
16 | | - |
| 16 | + |
17 | 17 | $msg = Xml::encodeJsVar( wfMsg( 'centralnotice-confirm-delete' ) ); |
18 | 18 | $this->onRemoveChange = "if( this.checked ) { this.checked = confirm( $msg ) }"; |
19 | 19 | $this->viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' ); |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | function getQueryInfo() { |
23 | 23 | // Return all the banners in the database |
24 | 24 | return array( |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | 'fields' => array( 'tmp_name', 'tmp_id' ), |
27 | 27 | ); |
28 | 28 | } |
29 | | - |
| 29 | + |
30 | 30 | /** |
31 | 31 | * Sort the banner list by tmp_id |
32 | 32 | */ |
— | — | @@ -38,10 +38,10 @@ |
39 | 39 | * Generate the content of each table row (1 row = 1 banner) |
40 | 40 | */ |
41 | 41 | function formatRow( $row ) { |
42 | | - |
| 42 | + |
43 | 43 | // Begin banner row |
44 | 44 | $htmlOut = Xml::openElement( 'tr' ); |
45 | | - |
| 45 | + |
46 | 46 | if ( $this->editable ) { |
47 | 47 | // Remove box |
48 | 48 | $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), |
— | — | @@ -53,12 +53,12 @@ |
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | } |
57 | | - |
| 57 | + |
58 | 58 | // Link and Preview |
59 | 59 | $render = new SpecialBannerLoader(); |
60 | 60 | $render->siteName = 'Wikipedia'; |
61 | 61 | $render->language = $this->mRequest->getVal( 'wpUserLanguage' ); |
62 | | - try { |
| 62 | + try { |
63 | 63 | $preview = $render->getHtmlNotice( $row->tmp_name ); |
64 | 64 | } catch ( SpecialBannerLoaderException $e ) { |
65 | 65 | $preview = wfMsg( 'centralnotice-nopreview' ); |
— | — | @@ -72,10 +72,10 @@ |
73 | 73 | array( 'class' => 'cn-bannerpreview') |
74 | 74 | ) |
75 | 75 | ); |
76 | | - |
| 76 | + |
77 | 77 | // End banner row |
78 | 78 | $htmlOut .= Xml::closeElement( 'tr' ); |
79 | | - |
| 79 | + |
80 | 80 | return $htmlOut; |
81 | 81 | } |
82 | 82 | |
— | — | @@ -107,9 +107,9 @@ |
108 | 108 | $htmlOut .= Xml::closeElement( 'table' ); |
109 | 109 | if ( $this->editable ) { |
110 | 110 | $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
111 | | - $htmlOut .= Xml::tags( 'div', |
112 | | - array( 'class' => 'cn-buttons' ), |
113 | | - Xml::submitButton( wfMsg( 'centralnotice-modify' ) ) |
| 111 | + $htmlOut .= Xml::tags( 'div', |
| 112 | + array( 'class' => 'cn-buttons' ), |
| 113 | + Xml::submitButton( wfMsg( 'centralnotice-modify' ) ) |
114 | 114 | ); |
115 | 115 | } |
116 | 116 | return $htmlOut; |
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -373,7 +373,7 @@ |
374 | 374 | 'centralnotice-template-exists' => 'Die sjabloon bestaan reeds. |
375 | 375 | Dit word nie bygevoeg nie.', |
376 | 376 | 'centralnotice-notice-doesnt-exist' => 'Die veldtog bestaan nie.', |
377 | | - 'centralnotice-remove-notice-doesnt-exist' => 'Die veldtog bestaan nie. |
| 377 | + 'centralnotice-remove-notice-doesnt-exist' => 'Die veldtog bestaan nie. |
378 | 378 | Niks om te verwyder nie.', |
379 | 379 | 'centralnotice-banner-doesnt-exist' => 'Die banier bestaan nie.', |
380 | 380 | 'centralnotice-template-still-bound' => "Die sjabloon is nog aan 'n kennisgewing gekoppel. |
— | — | @@ -2490,7 +2490,7 @@ |
2491 | 2491 | 'centralnotice-start-date' => 'Dyddiad cychwyn', |
2492 | 2492 | 'centralnotice-start-time' => 'Amser cychwyn (UTC)', |
2493 | 2493 | 'centralnotice-end-time' => 'Amser y daw i ben (UTC)', |
2494 | | - 'centralnotice-no-templates' => 'Ni chanfuwyd unrhyw faner. |
| 2494 | + 'centralnotice-no-templates' => 'Ni chanfuwyd unrhyw faner. |
2495 | 2495 | Ychwanegwch rai!', |
2496 | 2496 | 'centralnotice-no-templates-assigned' => "Ni briodolwyd baneri i'r ymgyrch. |
2497 | 2497 | Ychwanegwch rai!", |
— | — | @@ -2629,7 +2629,7 @@ |
2630 | 2630 | 'centralnotice-assigned-templates' => 'Tildelte bannere', |
2631 | 2631 | 'centralnotice-no-templates' => 'Ingen bannere fundet. |
2632 | 2632 | Tilføj nogle!', |
2633 | | - 'centralnotice-no-templates-assigned' => 'Ingen bannere tildelt kampagne. |
| 2633 | + 'centralnotice-no-templates-assigned' => 'Ingen bannere tildelt kampagne. |
2634 | 2634 | Tilføj nogle!', |
2635 | 2635 | 'centralnotice-available-templates' => 'Tilgængelige bannere', |
2636 | 2636 | 'centralnotice-preview-template' => 'Forhåndsvis banner', |
— | — | @@ -2738,7 +2738,7 @@ |
2739 | 2739 | 'centralnotice-template-exists' => 'Vorlage ist bereits vorhanden. |
2740 | 2740 | Sie wird daher nicht hinzugefügt.', |
2741 | 2741 | 'centralnotice-notice-doesnt-exist' => 'Meldung ist nicht vorhanden.', |
2742 | | - 'centralnotice-remove-notice-doesnt-exist' => 'Die Meldung ist nicht vorhanden. |
| 2742 | + 'centralnotice-remove-notice-doesnt-exist' => 'Die Meldung ist nicht vorhanden. |
2743 | 2743 | Entfernen nicht möglich.', |
2744 | 2744 | 'centralnotice-banner-doesnt-exist' => 'Die Vorlage ist nicht vorhanden.', |
2745 | 2745 | 'centralnotice-template-still-bound' => 'Vorlage ist noch an eine Meldung gebunden. |
— | — | @@ -3166,7 +3166,7 @@ |
3167 | 3167 | 'centralnotice-template-exists' => 'Το πρότυπο υπάρχει ήδη. |
3168 | 3168 | Δεν προστέθηκε', |
3169 | 3169 | 'centralnotice-notice-doesnt-exist' => 'Καμπάνια δεν υπάρχει.', |
3170 | | - 'centralnotice-remove-notice-doesnt-exist' => 'Καμπάνια δεν υπάρχει. |
| 3170 | + 'centralnotice-remove-notice-doesnt-exist' => 'Καμπάνια δεν υπάρχει. |
3171 | 3171 | Τίποτε προς διαγραφή.', |
3172 | 3172 | 'centralnotice-banner-doesnt-exist' => 'Το λογότυπο δεν υπάρχει.', |
3173 | 3173 | 'centralnotice-template-still-bound' => 'Το πρότυπο είναι ακόμη συνδεδεμένο με ένα σημείωμα. |
— | — | @@ -4103,7 +4103,7 @@ |
4104 | 4104 | 'centralnotice-template-exists' => 'Malline on jo olemassa. |
4105 | 4105 | Ei lisätä', |
4106 | 4106 | 'centralnotice-notice-doesnt-exist' => 'Kampanjaa ei ole olemassa.', |
4107 | | - 'centralnotice-remove-notice-doesnt-exist' => 'Kampanjaa ei ole olemassa. |
| 4107 | + 'centralnotice-remove-notice-doesnt-exist' => 'Kampanjaa ei ole olemassa. |
4108 | 4108 | Ei poistettavaa.', |
4109 | 4109 | 'centralnotice-banner-doesnt-exist' => 'Banneria ei ole olemassa.', |
4110 | 4110 | 'centralnotice-template-still-bound' => 'Malline on vielä kytkettynä tiedotteeseen. |
— | — | @@ -5284,7 +5284,7 @@ |
5285 | 5285 | 'centralnotice-no-allocation' => 'Nema dodijeljenih obavijesti.', |
5286 | 5286 | 'centralnotice-allocation-description' => 'Dodjela obavijesti za $1.$2 u $3:', |
5287 | 5287 | 'centralnotice-percentage' => 'Postotak', |
5288 | | - 'centralnotice-documentwrite-error' => 'document.write() ne može se rabiti unutar obavijesti. |
| 5288 | + 'centralnotice-documentwrite-error' => 'document.write() ne može se rabiti unutar obavijesti. |
5289 | 5289 | Pogledajte http://meta.wikimedia.org/wiki/Help:CentralNotice za više informacija.', |
5290 | 5290 | 'centralnotice-preferred' => 'Željeno', |
5291 | 5291 | 'centralnotice-talk-link' => 'razgovor', |
— | — | @@ -6547,7 +6547,7 @@ |
6548 | 6548 | 'centralnotice-no-allocation' => 'ბანერები არ განაწილდა.', |
6549 | 6549 | 'centralnotice-allocation-description' => 'ბანერთა განაწილება $1.$2-თვის $3–ში:', |
6550 | 6550 | 'centralnotice-percentage' => 'პროცენტი', |
6551 | | - 'centralnotice-documentwrite-error' => 'document.write() არ შეიძლება გამოყენებული იქნას ბანერის შიგნით. |
| 6551 | + 'centralnotice-documentwrite-error' => 'document.write() არ შეიძლება გამოყენებული იქნას ბანერის შიგნით. |
6552 | 6552 | იხილეთ http://meta.wikimedia.org/wiki/Help:CentralNotice მეტი ინფორმაციისათვის.', |
6553 | 6553 | 'centralnotice-preferred' => 'პრივილეგირებული', |
6554 | 6554 | 'centralnotice-logs' => 'ჟურნალები', |
— | — | @@ -8096,7 +8096,7 @@ |
8097 | 8097 | 'centralnotice-change-lang' => 'भाषांतरासाठी भाषेत बदल करा', |
8098 | 8098 | 'centralnotice-weights' => 'वजन', |
8099 | 8099 | 'centralnotice-notice-is-locked' => 'मथळ्यास ताळा लावला आहे. काढु नका.', |
8100 | | - 'centralnotice-confirm-delete' => 'आपणास हा मजकुर नक्की गाळावयाचा आहे काय? |
| 8100 | + 'centralnotice-confirm-delete' => 'आपणास हा मजकुर नक्की गाळावयाचा आहे काय? |
8101 | 8101 | ही कृती परतविता येणार नाही.', |
8102 | 8102 | 'centralnotice-no-notices-exist' => 'मथळा अस्तित्वात नाही. |
8103 | 8103 | एक मथळा खाली जोडा.', |
— | — | @@ -8696,7 +8696,7 @@ |
8697 | 8697 | 'centralnotice-no-allocation' => 'Geen banners toegewezen.', |
8698 | 8698 | 'centralnotice-allocation-description' => 'Bannertoewijzing voor $1.$2 in $3:', |
8699 | 8699 | 'centralnotice-percentage' => 'Percentage', |
8700 | | - 'centralnotice-documentwrite-error' => 'document.write() kan niet worden gebruikt binnen een banner. |
| 8700 | + 'centralnotice-documentwrite-error' => 'document.write() kan niet worden gebruikt binnen een banner. |
8701 | 8701 | Zie http://meta.wikimedia.org/wiki/Help:CentralNotice voor meer informatie.', |
8702 | 8702 | 'centralnotice-preferred' => 'Voorkeur', |
8703 | 8703 | 'centralnotice-logs' => 'Logboeken', |
— | — | @@ -9357,7 +9357,7 @@ |
9358 | 9358 | 'centralnotice-no-project' => 'Żaden projekt nie został wybrany dla kampanii. Nic nie dodano.', |
9359 | 9359 | 'centralnotice-template-exists' => 'Szablon o podanej nazwie już istnieje. Nowy szablon nie został dodany.', |
9360 | 9360 | 'centralnotice-notice-doesnt-exist' => 'Kampania nie istnieje.', |
9361 | | - 'centralnotice-remove-notice-doesnt-exist' => 'Kampania nie istnieje. |
| 9361 | + 'centralnotice-remove-notice-doesnt-exist' => 'Kampania nie istnieje. |
9362 | 9362 | Usunięcie jest niemożliwe.', |
9363 | 9363 | 'centralnotice-banner-doesnt-exist' => 'Baner nie istnieje.', |
9364 | 9364 | 'centralnotice-template-still-bound' => 'Szablon nie może zostać usunięty. Jest ciągle używany przez komunikat.', |
— | — | @@ -10443,17 +10443,17 @@ |
10444 | 10444 | 'centralnotice-notice' => 'Campanie', |
10445 | 10445 | 'centralnotice-notice-heading' => 'Campanie: $1', |
10446 | 10446 | 'centralnotice-notices' => 'Notificări', |
10447 | | - 'centralnotice-notice-exists' => 'Campania există deja. |
| 10447 | + 'centralnotice-notice-exists' => 'Campania există deja. |
10448 | 10448 | Nu se adaugă.', |
10449 | 10449 | 'centralnotice-no-language' => 'Nicio limbă nu a fost selectată pentru campanie. Nu se adaugă.', |
10450 | 10450 | 'centralnotice-no-project' => 'Niciun proiect nu a fost selectat pentru campanie. Nu se adaugă.', |
10451 | | - 'centralnotice-template-exists' => 'Bannerul există deja. |
| 10451 | + 'centralnotice-template-exists' => 'Bannerul există deja. |
10452 | 10452 | Nu se adaugă.', |
10453 | 10453 | 'centralnotice-notice-doesnt-exist' => 'Campania nu există.', |
10454 | | - 'centralnotice-remove-notice-doesnt-exist' => 'Campania nu există. |
| 10454 | + 'centralnotice-remove-notice-doesnt-exist' => 'Campania nu există. |
10455 | 10455 | Nimic de eliminat.', |
10456 | 10456 | 'centralnotice-banner-doesnt-exist' => 'Bannerul nu există.', |
10457 | | - 'centralnotice-template-still-bound' => 'Bannerul este încă legat de o campanie. |
| 10457 | + 'centralnotice-template-still-bound' => 'Bannerul este încă legat de o campanie. |
10458 | 10458 | Nu se elimină.', |
10459 | 10459 | 'centralnotice-template-body' => 'Corpul bannerului:', |
10460 | 10460 | 'centralnotice-day' => 'Zi', |
— | — | @@ -10489,7 +10489,7 @@ |
10490 | 10490 | Nu se adaugă.', |
10491 | 10491 | 'centralnotice-confirm-delete' => 'Sunteți sigur că doriți să ștergeți acest element? |
10492 | 10492 | Acțiunea este iremediabilă.', |
10493 | | - 'centralnotice-no-notices-exist' => 'Nu există campanii. |
| 10493 | + 'centralnotice-no-notices-exist' => 'Nu există campanii. |
10494 | 10494 | Adăugați una mai jos.', |
10495 | 10495 | 'centralnotice-no-templates-translate' => 'Nu există bannere de tradus.', |
10496 | 10496 | 'centralnotice-number-uses' => 'Utilizări', |
— | — | @@ -11347,7 +11347,7 @@ |
11348 | 11348 | 'right-centralnotice-admin' => 'ප්රධාන දැන්වීම් පාලනය කරන්න', |
11349 | 11349 | 'action-centralnotice-admin' => 'ප්රධාන දැන්වීම් පාලනය කරන්න', |
11350 | 11350 | 'centralnotice-desc' => 'ප්රධාන අඩවි දැන්වීමක් එකතු කරයි', |
11351 | | - 'centralnotice-summary' => 'මෙම ඒකකය මගින් ඔබ දැනට පිහිටුවා ඇති ප්රධාන දැන්වීම් සංස්කරණය කළ හැකිය. |
| 11351 | + 'centralnotice-summary' => 'මෙම ඒකකය මගින් ඔබ දැනට පිහිටුවා ඇති ප්රධාන දැන්වීම් සංස්කරණය කළ හැකිය. |
11352 | 11352 | එය පැරැණි දැන්වීම් එකතු කිරීමට හෝ අයින් කිරීමට ද භාවිතා කළ හැකිය.', |
11353 | 11353 | 'centralnotice-query' => 'වත්මන් ව්යාපාර සංස්කරණය කරන්න', |
11354 | 11354 | 'centralnotice-notice-name' => 'ව්යාපාරයේ නම', |
— | — | @@ -11390,13 +11390,13 @@ |
11391 | 11391 | එකතු කරනු නොලැබේ.', |
11392 | 11392 | 'centralnotice-no-language' => 'ව්යාපාරය සඳහා භාෂාවක් තෝරාගෙන නැත. එකතු කරනු නොලැබේ.', |
11393 | 11393 | 'centralnotice-no-project' => 'ව්යාපාරය සඳහා ව්යාපෘතියක් තෝරාගෙන නැත. එකතු කරනු නොලැබේ.', |
11394 | | - 'centralnotice-template-exists' => 'බැනරය දැනටමත් පවතී. |
| 11394 | + 'centralnotice-template-exists' => 'බැනරය දැනටමත් පවතී. |
11395 | 11395 | එකතු කරනු නොලැබේ.', |
11396 | 11396 | 'centralnotice-notice-doesnt-exist' => 'ව්යාපාරය නොපවතී.', |
11397 | 11397 | 'centralnotice-remove-notice-doesnt-exist' => 'ව්යාපාරය නොපවතී. |
11398 | 11398 | අයින් කිරීමට කිසිවක් නැත.', |
11399 | 11399 | 'centralnotice-banner-doesnt-exist' => 'බැනරය නොපවතී.', |
11400 | | - 'centralnotice-template-still-bound' => 'බැනරය තවමත් ව්යාපාරයකට බැඳී ඇත. |
| 11400 | + 'centralnotice-template-still-bound' => 'බැනරය තවමත් ව්යාපාරයකට බැඳී ඇත. |
11401 | 11401 | ඉවත් නොකෙරේ.', |
11402 | 11402 | 'centralnotice-template-body' => 'බැනර බඳ:', |
11403 | 11403 | 'centralnotice-day' => 'දවස', |
— | — | @@ -11417,12 +11417,12 @@ |
11418 | 11418 | 'centralnotice-no-templates-assigned' => 'ව්යාපාරයට බැනර පවරා නැත. |
11419 | 11419 | එකතු කරන්න!', |
11420 | 11420 | 'centralnotice-available-templates' => 'දැනට ඇති බැනර', |
11421 | | - 'centralnotice-template-already-exists' => 'බැනරය දැනටමත් ව්යාපෘතියට බැඳී ඇත. |
| 11421 | + 'centralnotice-template-already-exists' => 'බැනරය දැනටමත් ව්යාපෘතියට බැඳී ඇත. |
11422 | 11422 | එකතු නොකෙරේ.', |
11423 | 11423 | 'centralnotice-preview-template' => 'බැනර පෙරදසුන', |
11424 | 11424 | 'centralnotice-change-lang' => 'පරිවර්තන භාෂාව වෙනස් කරන්න', |
11425 | 11425 | 'centralnotice-weights' => 'බර', |
11426 | | - 'centralnotice-notice-is-locked' => 'ව්යාපාරය අගුළු ලා ඇත. |
| 11426 | + 'centralnotice-notice-is-locked' => 'ව්යාපාරය අගුළු ලා ඇත. |
11427 | 11427 | ඉවත් නොකෙරේ.', |
11428 | 11428 | 'centralnotice-overlap' => 'ව්යාපාරය තවත් ව්යාපාරයක කාල පරාසය සමග අතිච්ඡාදනය වේ. |
11429 | 11429 | එකතු නොකෙරේ.', |
— | — | @@ -11472,7 +11472,7 @@ |
11473 | 11473 | 'centralnotice-no-allocation' => 'බැනර වෙන්කර නැත', |
11474 | 11474 | 'centralnotice-allocation-description' => '$3 හි $1.$2 සඳහා බෙැනර වෙන්කිරීම', |
11475 | 11475 | 'centralnotice-percentage' => 'ප්රතිශත', |
11476 | | - 'centralnotice-documentwrite-error' => 'බැනරය තුළ document.write() යොදාගත නොහැකිය. |
| 11476 | + 'centralnotice-documentwrite-error' => 'බැනරය තුළ document.write() යොදාගත නොහැකිය. |
11477 | 11477 | වැඩි විස්තර සඳහා http://meta.wikimedia.org/wiki/Help:CentralNotice බලන්න.', |
11478 | 11478 | 'centralnotice-preferred' => 'වඩා කැමති', |
11479 | 11479 | 'centralnotice-logs' => 'සටහන්', |
— | — | @@ -11811,7 +11811,7 @@ |
11812 | 11812 | 'right-centralnotice-admin' => 'Menaxhoni mesazhet qendrore', |
11813 | 11813 | 'action-centralnotice-admin' => 'menaxhoni mesazhet qendrore', |
11814 | 11814 | 'centralnotice-desc' => 'Ju lejon, të krijoni mesazhe qendrore për Wiki.', |
11815 | | - 'centralnotice-summary' => 'Ky modul ju lejon që të editoni shënimet tuaja të tanishme qendrore. |
| 11815 | + 'centralnotice-summary' => 'Ky modul ju lejon që të editoni shënimet tuaja të tanishme qendrore. |
11816 | 11816 | Ai gjithashtu mund të përdoret për të shtuar ose hequr njoftime të vjetra.', |
11817 | 11817 | 'centralnotice-query' => 'Ndryshoni mesazhin aktuale', |
11818 | 11818 | 'centralnotice-notice-name' => 'Emri i shënimit', |
— | — | @@ -11848,11 +11848,11 @@ |
11849 | 11849 | 'centralnotice-notice' => 'Mesazh', |
11850 | 11850 | 'centralnotice-notice-heading' => 'Mesazh: $1', |
11851 | 11851 | 'centralnotice-notices' => 'Mesazhet', |
11852 | | - 'centralnotice-notice-exists' => 'Ky mesazhi ekziston. |
| 11852 | + 'centralnotice-notice-exists' => 'Ky mesazhi ekziston. |
11853 | 11853 | Prandaj mesazhi nuk është shtuar.', |
11854 | 11854 | 'centralnotice-no-language' => 'Për këtë mesaxh nuk është zgjedhur gjuha. Prandaj nuk u shtuar.', |
11855 | 11855 | 'centralnotice-no-project' => 'Për këtë projekt nuk është zgjedhur fushata. Prandaj nuk u shtuar.', |
11856 | | - 'centralnotice-template-exists' => 'Stampa ekziston. |
| 11856 | + 'centralnotice-template-exists' => 'Stampa ekziston. |
11857 | 11857 | Prandaj stampa nuk është shtuar.', |
11858 | 11858 | 'centralnotice-notice-doesnt-exist' => 'Mesazhi nuk ekziston.', |
11859 | 11859 | 'centralnotice-remove-notice-doesnt-exist' => 'Mesazhi nuk ekziston. |
— | — | @@ -11874,7 +11874,7 @@ |
11875 | 11875 | 'centralnotice-start-time' => 'Koha e fillimit (UTC)', |
11876 | 11876 | 'centralnotice-end-time' => 'Koha e përfundimit', |
11877 | 11877 | 'centralnotice-assigned-templates' => 'Stampat e caktuara', |
11878 | | - 'centralnotice-no-templates' => 'Nuk ka rezultate që përputhen me kërkesën. |
| 11878 | + 'centralnotice-no-templates' => 'Nuk ka rezultate që përputhen me kërkesën. |
11879 | 11879 | Shtoje prandaj!', |
11880 | 11880 | 'centralnotice-no-templates-assigned' => 'Nuk ka baner të lidhur me fushatën. |
11881 | 11881 | Shtoni disa!', |
— | — | @@ -11886,11 +11886,11 @@ |
11887 | 11887 | 'centralnotice-weights' => 'Peshësia', |
11888 | 11888 | 'centralnotice-notice-is-locked' => 'Mesazhi është e bllokuar. |
11889 | 11889 | Kjo nuk mund të hiqet.', |
11890 | | - 'centralnotice-overlap' => 'Fushata përputhet me kohën e një fushate tjetër. |
| 11890 | + 'centralnotice-overlap' => 'Fushata përputhet me kohën e një fushate tjetër. |
11891 | 11891 | Nuk ka shtim.', |
11892 | 11892 | 'centralnotice-invalid-date-range' => 'Bashkësi e gabuar për datën. |
11893 | 11893 | Nuk ka përditësim.', |
11894 | | - 'centralnotice-null-string' => 'Nuk mund të shtoni një varg null. |
| 11894 | + 'centralnotice-null-string' => 'Nuk mund të shtoni një varg null. |
11895 | 11895 | Jo duke shtuar.', |
11896 | 11896 | 'centralnotice-confirm-delete' => 'Jeni i sigurt se doni ta grisni këtë artikull? |
11897 | 11897 | Ky veprim do të jetë i pakthyeshëm.', |
— | — | @@ -12384,7 +12384,7 @@ |
12385 | 12385 | 'centralnotice-no-allocation' => 'Inga banners tilldelade.', |
12386 | 12386 | 'centralnotice-allocation-description' => 'Bannertilldelning för $1.$2 i $3:', |
12387 | 12387 | 'centralnotice-percentage' => 'Procent', |
12388 | | - 'centralnotice-documentwrite-error' => 'document.write() kan inte användas inom en banner. |
| 12388 | + 'centralnotice-documentwrite-error' => 'document.write() kan inte användas inom en banner. |
12389 | 12389 | Se http://meta.wikimedia.org/wiki/Help:CentralNotice för mer information.', |
12390 | 12390 | 'centralnotice-preferred' => 'Föredragen', |
12391 | 12391 | 'centralnotice-logs' => 'Loggar', |
— | — | @@ -13640,7 +13640,7 @@ |
13641 | 13641 | 'centralnotice-no-allocation' => 'Немає розміщених банерів.', |
13642 | 13642 | 'centralnotice-allocation-description' => 'Розміщення банеру для $1.$2 в $3:', |
13643 | 13643 | 'centralnotice-percentage' => 'Відсоток', |
13644 | | - 'centralnotice-documentwrite-error' => 'document.write() не може бути використана в банері. |
| 13644 | + 'centralnotice-documentwrite-error' => 'document.write() не може бути використана в банері. |
13645 | 13645 | Дивіться http://meta.wikimedia.org/wiki/Help:CentralNotice для отримання додаткової інформації.', |
13646 | 13646 | 'centralnotice-preferred' => 'Бажано', |
13647 | 13647 | 'centralnotice-logs' => 'Журнали', |
Index: trunk/extensions/CentralNotice/bannerstats.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * This script retrieves click-thru rates for all the banners in all the campaigns in |
| 3 | + * This script retrieves click-thru rates for all the banners in all the campaigns in |
4 | 4 | * wgCentralNoticeAllocationCampaigns. It then adds the rates to the allocation tables. |
5 | 5 | */ |
6 | 6 | $( document ).ready( function () { |
Index: trunk/extensions/CentralNotice/CentralNoticePager.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | function __construct( $special ) { |
9 | 9 | parent::__construct( $special ); |
10 | 10 | } |
11 | | - |
| 11 | + |
12 | 12 | /** |
13 | 13 | * Pull banners from the database |
14 | 14 | */ |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | 'fields' => array( 'cn_templates.tmp_name', 'cn_templates.tmp_id' ), |
23 | 23 | 'conds' => array( 'cn_assignments.tmp_id IS NULL' ), |
24 | 24 | 'join_conds' => array( |
25 | | - 'cn_assignments' => array( |
| 25 | + 'cn_assignments' => array( |
26 | 26 | 'LEFT JOIN', |
27 | | - "cn_assignments.tmp_id = cn_templates.tmp_id " . |
| 27 | + "cn_assignments.tmp_id = cn_templates.tmp_id " . |
28 | 28 | "AND cn_assignments.not_id = $noticeId" |
29 | 29 | ) |
30 | 30 | ) |
— | — | @@ -36,15 +36,15 @@ |
37 | 37 | ); |
38 | 38 | } |
39 | 39 | } |
40 | | - |
| 40 | + |
41 | 41 | /** |
42 | 42 | * Generate the content of each table row (1 row = 1 banner) |
43 | 43 | */ |
44 | 44 | function formatRow( $row ) { |
45 | | - |
| 45 | + |
46 | 46 | // Begin banner row |
47 | 47 | $htmlOut = Xml::openElement( 'tr' ); |
48 | | - |
| 48 | + |
49 | 49 | if ( $this->editable ) { |
50 | 50 | // Add box |
51 | 51 | $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), |
— | — | @@ -53,8 +53,8 @@ |
54 | 54 | // Weight select |
55 | 55 | $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), |
56 | 56 | Xml::listDropDown( "weight[$row->tmp_id]", |
57 | | - CentralNotice::dropDownList( |
58 | | - wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5 ) |
| 57 | + CentralNotice::dropDownList( |
| 58 | + wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5 ) |
59 | 59 | ) , |
60 | 60 | '', |
61 | 61 | '25', |
— | — | @@ -62,12 +62,12 @@ |
63 | 63 | '' ) |
64 | 64 | ); |
65 | 65 | } |
66 | | - |
| 66 | + |
67 | 67 | // Link and Preview |
68 | 68 | $render = new SpecialBannerLoader(); |
69 | 69 | $render->siteName = 'Wikipedia'; |
70 | 70 | $render->language = $this->mRequest->getVal( 'wpUserLanguage' ); |
71 | | - try { |
| 71 | + try { |
72 | 72 | $preview = $render->getHtmlNotice( $row->tmp_name ); |
73 | 73 | } catch ( SpecialBannerLoaderException $e ) { |
74 | 74 | $preview = wfMsg( 'centralnotice-nopreview' ); |
— | — | @@ -81,13 +81,13 @@ |
82 | 82 | array( 'class' => 'cn-bannerpreview') |
83 | 83 | ) |
84 | 84 | ); |
85 | | - |
| 85 | + |
86 | 86 | // End banner row |
87 | 87 | $htmlOut .= Xml::closeElement( 'tr' ); |
88 | | - |
| 88 | + |
89 | 89 | return $htmlOut; |
90 | 90 | } |
91 | | - |
| 91 | + |
92 | 92 | /** |
93 | 93 | * Specify table headers |
94 | 94 | */ |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | $htmlOut .= Xml::closeElement( 'tr' ); |
111 | 111 | return $htmlOut; |
112 | 112 | } |
113 | | - |
| 113 | + |
114 | 114 | /** |
115 | 115 | * Close table |
116 | 116 | */ |
Index: trunk/extensions/CentralNotice/tests/CentralNoticeTest.php |
— | — | @@ -13,10 +13,10 @@ |
14 | 14 | self::$centralNotice = new CentralNotice; |
15 | 15 | $noticeName = 'PHPUnitTestCampaign'; |
16 | 16 | $enabled = 0; |
17 | | - $start = array( |
18 | | - "month" => '07', |
19 | | - "day" => '18', |
20 | | - "year" => '2011', |
| 17 | + $start = array( |
| 18 | + "month" => '07', |
| 19 | + "day" => '18', |
| 20 | + "year" => '2011', |
21 | 21 | "hour" => '23', |
22 | 22 | "min" => '55', |
23 | 23 | ); |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | self::$centralNotice->addCampaign( $noticeName, $enabled, $start, $projects, |
29 | 29 | $project_languages, $geotargeted, $geo_countries ); |
30 | 30 | $this->campaignId = CentralNotice::getNoticeId( 'PHPUnitTestCampaign' ); |
31 | | - |
| 31 | + |
32 | 32 | self::$noticeTemplate = new SpecialNoticeTemplate; |
33 | 33 | $bannerName = 'PHPUnitTestBanner'; |
34 | 34 | $body = 'testing'; |
— | — | @@ -35,20 +35,20 @@ |
36 | 36 | $displayAccount = 1; |
37 | 37 | $fundaising = 1; |
38 | 38 | $landingPages = 'JA1, JA2'; |
39 | | - self::$noticeTemplate->addTemplate( $bannerName, $body, $displayAnon, $displayAccount, |
| 39 | + self::$noticeTemplate->addTemplate( $bannerName, $body, $displayAnon, $displayAccount, |
40 | 40 | $fundaising, $landingPages ); |
41 | 41 | self::$centralNotice->addTemplateTo( 'PHPUnitTestCampaign', 'PHPUnitTestBanner', '25' ); |
42 | | - |
| 42 | + |
43 | 43 | self::$centralNoticeDB = new CentralNoticeDB; |
44 | 44 | } |
45 | | - |
| 45 | + |
46 | 46 | protected function tearDown() { |
47 | 47 | parent::tearDown(); |
48 | 48 | self::$centralNotice->removeCampaign( 'PHPUnitTestCampaign' ); |
49 | 49 | self::$centralNotice->removeTemplateFor( 'PHPUnitTestCampaign', 'PHPUnitTestBanner' ); |
50 | 50 | self::$noticeTemplate->removeTemplate ( 'PHPUnitTestBanner' ); |
51 | 51 | } |
52 | | - |
| 52 | + |
53 | 53 | public function testDropDownList() { |
54 | 54 | $text = 'Weight'; |
55 | 55 | $values = range ( 0, 50, 10 ); |
— | — | @@ -56,28 +56,28 @@ |
57 | 57 | "*Weight\n**0\n**10\n**20\n**30\n**40\n**50\n", |
58 | 58 | CentralNotice::dropDownList( $text, $values ) ); |
59 | 59 | } |
60 | | - |
| 60 | + |
61 | 61 | public function testGetNoticeProjects() { |
62 | 62 | $this->assertEquals( |
63 | 63 | array ( 'wikibooks', 'wikipedia' ), |
64 | 64 | CentralNotice::getNoticeProjects( 'PHPUnitTestCampaign' ) |
65 | 65 | ); |
66 | 66 | } |
67 | | - |
| 67 | + |
68 | 68 | public function testGetNoticeLanguages() { |
69 | 69 | $this->assertEquals( |
70 | 70 | array ( 'de', 'en' ), |
71 | 71 | CentralNotice::getNoticeLanguages( 'PHPUnitTestCampaign' ) |
72 | 72 | ); |
73 | 73 | } |
74 | | - |
| 74 | + |
75 | 75 | public function testGetNoticeCountries() { |
76 | 76 | $this->assertEquals( |
77 | 77 | array ( 'AF', 'US' ), |
78 | 78 | CentralNotice::getNoticeCountries( 'PHPUnitTestCampaign' ) |
79 | 79 | ); |
80 | 80 | } |
81 | | - |
| 81 | + |
82 | 82 | public function testGetCampaignBanners() { |
83 | 83 | $campaignId = CentralNotice::getNoticeId( 'PHPUnitTestCampaign' ); |
84 | 84 | $this->assertEquals( |
— | — | @@ -85,9 +85,9 @@ |
86 | 86 | json_encode( CentralNoticeDB::getCampaignBanners( $campaignId ) ) |
87 | 87 | ); |
88 | 88 | } |
89 | | - |
| 89 | + |
90 | 90 | public function testGetCampaignSettings() { |
91 | | - $campaignArray = array( |
| 91 | + $campaignArray = array( |
92 | 92 | 'enabled' => 0, |
93 | 93 | 'end' => 20110818235500, |
94 | 94 | 'geo' => 1, |
Index: trunk/extensions/CentralNotice/CentralNotice.db.php |
— | — | @@ -403,9 +403,9 @@ |
404 | 404 | $eBannerName = htmlspecialchars( $bannerName ); |
405 | 405 | $row = $dbr->selectRow( 'cn_templates', 'tmp_name', array( 'tmp_name' => $eBannerName ) ); |
406 | 406 | if ( $row ) { |
407 | | - return true; |
| 407 | + return true; |
408 | 408 | } else { |
409 | | - return false; |
| 409 | + return false; |
410 | 410 | } |
411 | 411 | } |
412 | 412 | |