Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -39,6 +39,12 @@ |
40 | 40 | // for cached content |
41 | 41 | $wgCentralNoticeLoader = true; |
42 | 42 | |
| 43 | +// Flag for turning on fundraising specific features |
| 44 | +$wgNoticeEnableFundraising = true; |
| 45 | + |
| 46 | +// Base URL for default fundraiser landing page (without query string) |
| 47 | +$wgNoticeFundraisingUrl = 'http://wikimediafoundation.org/wiki/Special:LandingCheck'; |
| 48 | + |
43 | 49 | // Source for live counter information |
44 | 50 | $wgNoticeCounterSource = 'http://wikimediafoundation.org/wiki/Special:ContributionTotal?action=raw'; |
45 | 51 | |
— | — | @@ -122,6 +128,8 @@ |
123 | 129 | $base . '/patches/patch-notice_languages.sql' ); |
124 | 130 | $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', |
125 | 131 | $base . '/patches/patch-template_settings.sql' ); |
| 132 | + $wgExtNewFields[] = array( 'cn_templates', 'tmp_fundraising', |
| 133 | + $base . '/patches/patch-template_fundraising.sql' ); |
126 | 134 | $wgExtNewTables[] = array( 'cn_notice_countries', |
127 | 135 | $base . '/patches/patch-notice_countries.sql' ); |
128 | 136 | $wgExtNewTables[] = array( 'cn_notice_projects', |
— | — | @@ -137,6 +145,8 @@ |
138 | 146 | $base . '/patches/patch-notice_languages.sql', true ) ); |
139 | 147 | $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon', |
140 | 148 | $base . '/patches/patch-template_settings.sql', true ) ); |
| 149 | + $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_fundraising', |
| 150 | + $base . '/patches/patch-template_fundraising.sql', true ) ); |
141 | 151 | $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries', |
142 | 152 | $base . '/patches/patch-notice_countries.sql', true ) ); |
143 | 153 | $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_projects', |
Index: trunk/extensions/CentralNotice/centralnotice.css |
— | — | @@ -53,6 +53,10 @@ |
54 | 54 | border-style: solid; |
55 | 55 | border-width: 1px; |
56 | 56 | } |
| 57 | +#preferences div#fundraisingInterface { |
| 58 | + margin-left:1.6em; |
| 59 | + margin-right:1.6em; |
| 60 | +} |
57 | 61 | |
58 | 62 | /* Vector-specific definitions */ |
59 | 63 | body.skin-vector #preferences fieldset.prefsection { |
Index: trunk/extensions/CentralNotice/SpecialBannerLoader.php |
— | — | @@ -20,11 +20,12 @@ |
21 | 21 | $wgOut->disable(); |
22 | 22 | $this->sendHeaders(); |
23 | 23 | |
24 | | - // Get user language from the query string |
| 24 | + // Get values from the query string |
25 | 25 | $this->language = $wgRequest->getText( 'userlang', 'en' ); |
26 | | - |
27 | | - // Get site name from the query string |
28 | 26 | $this->siteName = $wgRequest->getText( 'sitename', 'Wikipedia' ); |
| 27 | + $this->campaign = $wgRequest->getText( 'campaign', 'unknown' ); |
| 28 | + $this->fundraising = $wgRequest->getBool( 'fundraising', false ); |
| 29 | + $this->landingPages = $wgRequest->getText( 'landingpages' ); |
29 | 30 | |
30 | 31 | if ( $wgRequest->getText( 'banner' ) ) { |
31 | 32 | $bannerName = $wgRequest->getText( 'banner' ); |
— | — | @@ -71,7 +72,13 @@ |
72 | 73 | array( $this, 'getNoticeField' ), |
73 | 74 | $this->getNoticeTemplate() |
74 | 75 | ); |
75 | | - $bannerArray = array( 'banner' => $bannerHtml ); |
| 76 | + $bannerArray = array( |
| 77 | + 'bannerName' => $bannerName, |
| 78 | + 'bannerHtml' => $bannerHtml, |
| 79 | + 'campaign' => $this->campaign, |
| 80 | + 'fundraising' => $this->fundraising, |
| 81 | + 'landingPages' => $this->landingPages |
| 82 | + ); |
76 | 83 | $bannerJs = 'insertBanner('.FormatJson::encode( $bannerArray ).');'; |
77 | 84 | return $bannerJs; |
78 | 85 | } |
Index: trunk/extensions/CentralNotice/patches/patch-template_fundraising.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +-- Update to support fundraiser-specific functions for banners |
| 3 | + |
| 4 | +-- Store a flag indicating whether or not this is a fundraising banner |
| 5 | +ALTER TABLE /*$wgDBprefix*/cn_templates ADD `tmp_fundraising` bool NOT NULL DEFAULT 0; |
| 6 | +-- Store a list of one or more landing pages |
| 7 | +ALTER TABLE /*$wgDBprefix*/cn_templates ADD `tmp_landing_pages` VARCHAR( 255 ) NULL DEFAULT NULL; |
\ No newline at end of file |
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -127,6 +127,9 @@ |
128 | 128 | 'centralnotice-banner-type' => 'Banner type:', |
129 | 129 | 'centralnotice-banner-hidable' => 'Static/Hidable', |
130 | 130 | 'centralnotice-banner-collapsible' => 'Collapsible', |
| 131 | + 'centralnotice-banner-fundraising' => 'This is a fundraising banner', |
| 132 | + 'centralnotice-banner-fundraising-help' => 'Create an anchor tag in the banner body with id="cn_fundraising_link" and enter one or more landing pages below, for example, "JimmyAppeal01". The href of the link will be constructed automatically.', |
| 133 | + 'centralnotice-banner-landing-pages' => 'Landing pages (comma-separated):', |
131 | 134 | 'centralnotice-geotargeted' => 'Geotargeted', |
132 | 135 | 'centralnotice-countries' => 'Countries', |
133 | 136 | 'centralnotice-allocation' => 'Allocation', |
Index: trunk/extensions/CentralNotice/SpecialBannerController.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | * In order to circumvent the normal squid cache override we add '/cn.js' to the bannerlist URL. |
45 | 45 | */ |
46 | 46 | function getOutput() { |
47 | | - global $wgCentralPagePath, $wgContLang; |
| 47 | + global $wgCentralPagePath, $wgNoticeFundraisingUrl, $wgContLang; |
48 | 48 | |
49 | 49 | $js = $this->getScriptFunctions() . $this->getToggleScripts(); |
50 | 50 | $js .= <<<JAVASCRIPT |
— | — | @@ -54,11 +54,13 @@ |
55 | 55 | 'getVars': {} |
56 | 56 | }, |
57 | 57 | 'fn': { |
58 | | - 'loadBanner': function( bannerName ) { |
| 58 | + 'loadBanner': function( bannerName, fundraising, landingPages, campaign ) { |
59 | 59 | // Get the requested banner |
60 | 60 | var bannerPageQuery = $.param( { |
61 | | - 'banner': bannerName, 'userlang': wgUserLanguage, |
62 | | - 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country } ); |
| 61 | + 'banner': bannerName, 'campaign': campaign, 'userlang': wgUserLanguage, |
| 62 | + 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country, |
| 63 | + 'fundraising': fundraising, 'landingpages': landingPages |
| 64 | + } ); |
63 | 65 | var bannerPage = '?title=Special:BannerLoader&' + bannerPageQuery; |
64 | 66 | JAVASCRIPT; |
65 | 67 | $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"" . |
— | — | @@ -111,11 +113,15 @@ |
112 | 114 | // Return if there's nothing left after the grooming |
113 | 115 | if( groomedBannerList.length == 0 ) return false; |
114 | 116 | |
| 117 | + // Choose a random key |
| 118 | + var pointer = Math.floor( Math.random() * groomedBannerList.length ); |
| 119 | + |
115 | 120 | // Load a random banner from our groomed list |
116 | 121 | $.centralNotice.fn.loadBanner( |
117 | | - groomedBannerList[ |
118 | | - Math.floor( Math.random() * groomedBannerList.length ) |
119 | | - ].name |
| 122 | + groomedBannerList[pointer].name, |
| 123 | + groomedBannerList[pointer].fundraising, |
| 124 | + groomedBannerList[pointer].landing_pages, |
| 125 | + groomedBannerList[pointer].campaign |
120 | 126 | ); |
121 | 127 | }, |
122 | 128 | 'getQueryStringVariables': function() { |
— | — | @@ -151,9 +157,29 @@ |
152 | 158 | } |
153 | 159 | |
154 | 160 | function getScriptFunctions() { |
| 161 | + global $wgNoticeFundraisingUrl; |
155 | 162 | $script = <<<JAVASCRIPT |
156 | 163 | function insertBanner(bannerJson) { |
157 | | - jQuery('div#centralNotice').prepend( bannerJson.banner ); |
| 164 | + jQuery( 'div#centralNotice' ).prepend( bannerJson.bannerHtml ); |
| 165 | + if ( bannerJson.fundraising ) { |
| 166 | +JAVASCRIPT; |
| 167 | + $script .= "\n\t\tvar url = '" . |
| 168 | + Xml::escapeJsString( $wgNoticeFundraisingUrl ) . "';"; |
| 169 | + $script .= <<<JAVASCRIPT |
| 170 | + console.debug(bannerJson.landingPages.length); |
| 171 | + if ( bannerJson.landingPages.length ) { |
| 172 | + targets = String( bannerJson.landingPages ).split(','); |
| 173 | + url += "?" + jQuery.param( { |
| 174 | + 'landing_page': targets[Math.floor( Math.random() * targets.length )].replace( /^\s+|\s+$/, '' ) |
| 175 | + } ); |
| 176 | + url += "&" + jQuery.param( { |
| 177 | + 'utm_medium': 'sitenotice', 'utm_campaign': bannerJson.campaign, |
| 178 | + 'utm_source': bannerJson.bannerName, 'language': wgUserLanguage, |
| 179 | + 'country': Geo.country |
| 180 | + } ); |
| 181 | + jQuery( '#cn_fundraising_link' ).attr( 'href', url ); |
| 182 | + } |
| 183 | + } |
158 | 184 | } |
159 | 185 | function toggleNotice() { |
160 | 186 | var notice = document.getElementById('centralNotice'); |
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php |
— | — | @@ -88,7 +88,9 @@ |
89 | 89 | $newTemplateName, |
90 | 90 | $newTemplateBody, |
91 | 91 | $wgRequest->getBool( 'displayAnon' ), |
92 | | - $wgRequest->getBool( 'displayAccount' ) |
| 92 | + $wgRequest->getBool( 'displayAccount' ), |
| 93 | + $wgRequest->getBool( 'fundraising' ), |
| 94 | + $wgRequest->getVal( 'landingPages' ) |
93 | 95 | ); |
94 | 96 | $sub = 'view'; |
95 | 97 | } else { |
— | — | @@ -102,7 +104,9 @@ |
103 | 105 | $wgRequest->getText( 'template' ), |
104 | 106 | $wgRequest->getText( 'templateBody' ), |
105 | 107 | $wgRequest->getBool( 'displayAnon' ), |
106 | | - $wgRequest->getBool( 'displayAccount' ) |
| 108 | + $wgRequest->getBool( 'displayAccount' ), |
| 109 | + $wgRequest->getBool( 'fundraising' ), |
| 110 | + $wgRequest->getVal( 'landingPages' ) |
107 | 111 | ); |
108 | 112 | $sub = 'view'; |
109 | 113 | } |
— | — | @@ -226,36 +230,58 @@ |
227 | 231 | array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) ); |
228 | 232 | $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) ); |
229 | 233 | $htmlOut .= Html::hidden( 'wpMethod', 'addTemplate' ); |
| 234 | + |
| 235 | + // If there was an error, we'll need to restore the state of the form |
| 236 | + if ( $wgRequest->wasPosted() ) { |
| 237 | + $templateName = $wgRequest->getVal( 'templateName' ); |
| 238 | + $displayAnon = $wgRequest->getCheck( 'displayAnon' ); |
| 239 | + $displayAccount = $wgRequest->getCheck( 'displayAccount' ); |
| 240 | + $fundraising = $wgRequest->getCheck( 'fundraising' ); |
| 241 | + $landingPages = $wgRequest->getVal( 'landingPages' ); |
| 242 | + $body = $wgRequest->getVal( 'templateBody' ); |
| 243 | + } else { // Use default values |
| 244 | + $templateName = ''; |
| 245 | + $displayAnon = true; |
| 246 | + $displayAccount = true; |
| 247 | + $fundraising = false; |
| 248 | + $landingPages = ''; |
| 249 | + $body = ''; |
| 250 | + } |
| 251 | + |
230 | 252 | $htmlOut .= Xml::tags( 'p', null, |
231 | 253 | Xml::inputLabel( |
232 | 254 | wfMsg( 'centralnotice-banner-name' ), |
233 | | - 'templateName', 'templateName', 25, $wgRequest->getVal( 'templateName' ) |
| 255 | + 'templateName', 'templateName', 25, $templateName |
234 | 256 | ) |
235 | 257 | ); |
236 | 258 | |
| 259 | + // Display settings |
237 | 260 | $htmlOut .= Xml::openElement( 'p', null ); |
238 | 261 | $htmlOut .= wfMsg( 'centralnotice-banner-display' ); |
239 | | - if ( $wgRequest->wasPosted() ) { |
240 | | - // Restore checkbox state in event of error |
241 | | - $displayAnon = $wgRequest->getCheck( 'displayAnon' ); |
242 | | - } else { |
243 | | - // Default is checked |
244 | | - $displayAnon = true; |
245 | | - } |
246 | 262 | $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 'id' => 'displayAnon' ) ); |
247 | 263 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' ); |
248 | | - if ( $wgRequest->wasPosted() ) { |
249 | | - // Restore checkbox state in event of error |
250 | | - $displayAccount = $wgRequest->getCheck( 'displayAccount' ); |
251 | | - } else { |
252 | | - // Default is checked |
253 | | - $displayAccount = true; |
254 | | - } |
255 | 264 | $htmlOut .= Xml::check( 'displayAccount', $displayAccount, |
256 | 265 | array( 'id' => 'displayAccount' ) ); |
257 | 266 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' ); |
258 | 267 | $htmlOut .= Xml::closeElement( 'p' ); |
259 | 268 | |
| 269 | + // Fundraising settings |
| 270 | + $htmlOut .= Xml::openElement( 'p', null ); |
| 271 | + $htmlOut .= Xml::check( 'fundraising', $fundraising, array( 'id' => 'fundraising' ) ); |
| 272 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), 'fundraising' ); |
| 273 | + $htmlOut .= Xml::closeElement( 'p' ); |
| 274 | + $htmlOut .= Xml::openElement( 'div', array( 'id' => 'fundraisingInterface', 'style' => 'display: none;' ) ); |
| 275 | + $htmlOut .= Xml::tags( 'p', array(), wfMsg( 'centralnotice-banner-fundraising-help' ) ); |
| 276 | + $htmlOut .= Xml::tags( 'p', array(), |
| 277 | + Xml::inputLabel( |
| 278 | + wfMsg( 'centralnotice-banner-landing-pages' ), |
| 279 | + 'landingPages', 'landingPages', 40, $landingPages, |
| 280 | + array( 'maxlength' => 255 ) |
| 281 | + ) |
| 282 | + ); |
| 283 | + $htmlOut .= Xml::closeElement( 'div' ); |
| 284 | + |
| 285 | + // Begin banner body section |
260 | 286 | $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) ); |
261 | 287 | $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' ); |
262 | 288 | $buttons = array(); |
— | — | @@ -267,9 +293,6 @@ |
268 | 294 | wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) ) |
269 | 295 | ); |
270 | 296 | |
271 | | - // Restore banner body state in the event of an error on form submit |
272 | | - $body = $wgRequest->getVal( 'templateBody', '' ); |
273 | | - |
274 | 297 | $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20 ); |
275 | 298 | $htmlOut .= Xml::closeElement( 'fieldset' ); |
276 | 299 | $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
— | — | @@ -315,7 +338,9 @@ |
316 | 339 | $row = $dbr->selectRow( 'cn_templates', |
317 | 340 | array( |
318 | 341 | 'tmp_display_anon', |
319 | | - 'tmp_display_account' |
| 342 | + 'tmp_display_account', |
| 343 | + 'tmp_fundraising', |
| 344 | + 'tmp_landing_pages' |
320 | 345 | ), |
321 | 346 | array( 'tmp_name' => $currentTemplate ), |
322 | 347 | __METHOD__ |
— | — | @@ -526,10 +551,15 @@ |
527 | 552 | if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'mainform' ) ) { |
528 | 553 | $displayAnon = $wgRequest->getCheck( 'displayAnon' ); |
529 | 554 | $displayAccount = $wgRequest->getCheck( 'displayAccount' ); |
| 555 | + $fundraising = $wgRequest->getCheck( 'fundraising' ); |
| 556 | + $landingPages = $wgRequest->getVal( 'landingPages' ); |
530 | 557 | $body = $wgRequest->getVal( 'templateBody', $body ); |
531 | | - } else { // Defaults |
| 558 | + } else { // Use previously stored values |
532 | 559 | $displayAnon = ( $row->tmp_display_anon == 1 ); |
533 | 560 | $displayAccount = ( $row->tmp_display_account == 1 ); |
| 561 | + $fundraising = ( $row->tmp_fundraising == 1 ); |
| 562 | + $landingPages = $row->tmp_landing_pages; |
| 563 | + // $body default is defined prior to message interface code |
534 | 564 | } |
535 | 565 | |
536 | 566 | // Show banner settings |
— | — | @@ -543,6 +573,29 @@ |
544 | 574 | wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) ); |
545 | 575 | $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' ); |
546 | 576 | $htmlOut .= Xml::closeElement( 'p' ); |
| 577 | + |
| 578 | + // Fundraising settings |
| 579 | + $htmlOut .= Xml::openElement( 'p', null ); |
| 580 | + $htmlOut .= Xml::check( 'fundraising', $fundraising, |
| 581 | + wfArrayMerge( $disabled, array( 'id' => 'fundraising' ) ) ); |
| 582 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), 'fundraising' ); |
| 583 | + $htmlOut .= Xml::closeElement( 'p' ); |
| 584 | + if ( $fundraising ) { |
| 585 | + $htmlOut .= Xml::openElement( 'div', array( 'id'=>'fundraisingInterface' ) ); |
| 586 | + } else { |
| 587 | + $htmlOut .= Xml::openElement( 'div', array( 'id'=>'fundraisingInterface', 'style'=>'display:none;' ) ); |
| 588 | + } |
| 589 | + $htmlOut .= Xml::tags( 'p', array(), wfMsg( 'centralnotice-banner-fundraising-help' ) ); |
| 590 | + $htmlOut .= Xml::tags( 'p', array(), |
| 591 | + Xml::inputLabel( |
| 592 | + wfMsg( 'centralnotice-banner-landing-pages' ), |
| 593 | + 'landingPages', 'landingPages', 40, $landingPages, |
| 594 | + array( 'maxlength' => 255 ) |
| 595 | + ) |
| 596 | + ); |
| 597 | + $htmlOut .= Xml::closeElement( 'div' ); |
| 598 | + |
| 599 | + // Begin banner body section |
547 | 600 | $htmlOut .= Xml::closeElement( 'fieldset' ); |
548 | 601 | if ( $this->editable ) { |
549 | 602 | $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-edit-template' ) ); |
— | — | @@ -708,7 +761,7 @@ |
709 | 762 | /** |
710 | 763 | * Create a new banner |
711 | 764 | */ |
712 | | - private function addTemplate( $name, $body, $displayAnon, $displayAccount ) { |
| 765 | + private function addTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising, $landingPages ) { |
713 | 766 | if ( $body == '' || $name == '' ) { |
714 | 767 | $this->showError( 'centralnotice-null-string' ); |
715 | 768 | return; |
— | — | @@ -734,12 +787,14 @@ |
735 | 788 | array( |
736 | 789 | 'tmp_name' => $name, |
737 | 790 | 'tmp_display_anon' => $displayAnon, |
738 | | - 'tmp_display_account' => $displayAccount |
| 791 | + 'tmp_display_account' => $displayAccount, |
| 792 | + 'tmp_fundraising' => $fundraising, |
| 793 | + 'tmp_landing_pages' => $landingPages |
739 | 794 | ), |
740 | 795 | __METHOD__ |
741 | 796 | ); |
742 | 797 | |
743 | | - // Perhaps these should move into the db as blob |
| 798 | + // Perhaps these should move into the db as blobs instead of being stored as articles |
744 | 799 | $article = new Article( |
745 | 800 | Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI ) |
746 | 801 | ); |
— | — | @@ -751,7 +806,7 @@ |
752 | 807 | /** |
753 | 808 | * Update a banner |
754 | 809 | */ |
755 | | - private function editTemplate( $name, $body, $displayAnon, $displayAccount ) { |
| 810 | + private function editTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising, $landingPages ) { |
756 | 811 | if ( $body == '' || $name == '' ) { |
757 | 812 | $this->showError( 'centralnotice-null-string' ); |
758 | 813 | return; |
— | — | @@ -768,7 +823,9 @@ |
769 | 824 | $res = $dbw->update( 'cn_templates', |
770 | 825 | array( |
771 | 826 | 'tmp_display_anon' => $displayAnon, |
772 | | - 'tmp_display_account' => $displayAccount |
| 827 | + 'tmp_display_account' => $displayAccount, |
| 828 | + 'tmp_fundraising' => $fundraising, |
| 829 | + 'tmp_landing_pages' => $landingPages |
773 | 830 | ), |
774 | 831 | array( 'tmp_name' => $name ) |
775 | 832 | ); |
— | — | @@ -801,20 +858,24 @@ |
802 | 859 | $row = $dbr->selectRow( 'cn_templates', |
803 | 860 | array( |
804 | 861 | 'tmp_display_anon', |
805 | | - 'tmp_display_account' |
| 862 | + 'tmp_display_account', |
| 863 | + 'tmp_fundraising', |
| 864 | + 'tmp_landing_pages' |
806 | 865 | ), |
807 | 866 | array( 'tmp_name' => $source ), |
808 | 867 | __METHOD__ |
809 | 868 | ); |
810 | 869 | $displayAnon = $row->tmp_display_anon; |
811 | 870 | $displayAccount = $row->tmp_display_account; |
| 871 | + $fundraising = $row->tmp_fundraising; |
| 872 | + $landingPages = $row->tmp_landing_pages; |
812 | 873 | |
813 | 874 | // Pull banner text and respect any inc: markup |
814 | 875 | $bodyPage = Title::newFromText( "Centralnotice-template-{$source}", NS_MEDIAWIKI ); |
815 | 876 | $template_body = Revision::newFromTitle( $bodyPage )->getText(); |
816 | 877 | |
817 | 878 | // Create new banner |
818 | | - if ( $this->addTemplate( $dest, $template_body, $displayAnon, $displayAccount ) ) { |
| 879 | + if ( $this->addTemplate( $dest, $template_body, $displayAnon, $displayAccount, $fundraising, $landingPages ) ) { |
819 | 880 | |
820 | 881 | // Populate the fields |
821 | 882 | foreach ( $langs as $lang => $fields ) { |
Index: trunk/extensions/CentralNotice/CentralNotice.db.php |
— | — | @@ -143,7 +143,9 @@ |
144 | 144 | 'tmp_name', |
145 | 145 | 'tmp_weight', |
146 | 146 | 'tmp_display_anon', |
147 | | - 'tmp_display_account' |
| 147 | + 'tmp_display_account', |
| 148 | + 'tmp_fundraising', |
| 149 | + 'tmp_landing_pages' |
148 | 150 | ), |
149 | 151 | array( |
150 | 152 | 'cn_notices.not_id' => $campaignId, |
— | — | @@ -159,7 +161,9 @@ |
160 | 162 | 'weight' => intval( $row->tmp_weight ), |
161 | 163 | 'display_anon' => intval( $row->tmp_display_anon ), |
162 | 164 | 'display_account' => intval( $row->tmp_display_account ), |
163 | | - 'campaign' => CentralNotice::getNoticeName( $campaignId ), |
| 165 | + 'fundraising' => intval( $row->tmp_fundraising ), |
| 166 | + 'landing_pages' => $row->tmp_landing_pages, |
| 167 | + 'campaign' => CentralNotice::getNoticeName( $campaignId ) |
164 | 168 | ); |
165 | 169 | } |
166 | 170 | } |
Index: trunk/extensions/CentralNotice/centralnotice.js |
— | — | @@ -69,5 +69,12 @@ |
70 | 70 | $("#geoMultiSelector").fadeOut('fast'); |
71 | 71 | } |
72 | 72 | }); |
| 73 | + $("#fundraising").click(function () { |
| 74 | + if ($('#fundraising:checked').val() !== undefined) { |
| 75 | + $("#fundraisingInterface").fadeIn('fast'); |
| 76 | + } else { |
| 77 | + $("#fundraisingInterface").fadeOut('fast'); |
| 78 | + } |
| 79 | + }); |
73 | 80 | }); |
74 | 81 | })(jQuery); |