http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99181
Revision: 99181 Author: kaldari Date: 2011-10-07 01:28:31 +0000 (Fri, 07 Oct 2011) Log Message: ----------- more generic messaging, automatically constructed fundraising links dont neccessaily use LandingCheck Modified Paths: -------------- trunk/extensions/CentralNotice/CentralNotice.db.php trunk/extensions/CentralNotice/CentralNotice.i18n.php trunk/extensions/CentralNotice/CentralNotice.php trunk/extensions/CentralNotice/CentralNoticeBannerLogPager.php trunk/extensions/CentralNotice/centralnotice.js trunk/extensions/CentralNotice/special/SpecialBannerController.php trunk/extensions/CentralNotice/special/SpecialBannerLoader.php trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php Added Paths: ----------- trunk/extensions/CentralNotice/patches/patch-template_autolink.sql Removed Paths: ------------- trunk/extensions/CentralNotice/patches/patch-template_landingcheck.sql Modified: trunk/extensions/CentralNotice/CentralNotice.db.php =================================================================== --- trunk/extensions/CentralNotice/CentralNotice.db.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/CentralNotice.db.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -214,7 +214,7 @@ 'tmp_display_anon', 'tmp_display_account', 'tmp_fundraising', - 'tmp_landingcheck', + 'tmp_autolink', 'tmp_landing_pages', 'not_name' ), @@ -233,7 +233,7 @@ 'display_anon' => intval( $row->tmp_display_anon ), // display to anonymous users? 'display_account' => intval( $row->tmp_display_account ), // display to logged in users? 'fundraising' => intval( $row->tmp_fundraising ), // fundraising banner? - 'landingcheck' => intval( $row->tmp_landingcheck ), // use LandingCheck? + 'autolink' => intval( $row->tmp_autolink ), // automatically create links? 'landing_pages' => $row->tmp_landing_pages, // landing pages to link to 'campaign' => $row->not_name // campaign the banner is assigned to ); @@ -265,7 +265,7 @@ 'tmp_display_anon', 'tmp_display_account', 'tmp_fundraising', - 'tmp_landingcheck', + 'tmp_autolink', 'tmp_landing_pages' ), array( 'tmp_name' => $bannerName ), @@ -277,7 +277,7 @@ 'anon' => $row->tmp_display_anon, 'account' => $row->tmp_display_account, 'fundraising' => $row->tmp_fundraising, - 'landingcheck' => $row->tmp_landingcheck, + 'autolink' => $row->tmp_autolink, 'landingpages' => $row->tmp_landing_pages ); } Modified: trunk/extensions/CentralNotice/CentralNotice.i18n.php =================================================================== --- trunk/extensions/CentralNotice/CentralNotice.i18n.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/CentralNotice.i18n.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -168,7 +168,7 @@ 'centralnotice-anon' => 'Display to anonymous users', 'centralnotice-account' => 'Display to logged in users', 'centralnotice-fundraising' => 'Fundraising', - 'centralnotice-landingcheck' => 'LandingCheck', + 'centralnotice-autolink' => 'Automatic link creation', 'centralnotice-landingpages' => 'Landing pages', 'centralnotice-banner-content' => 'Banner content', 'centralnotice-banner-content-changed' => 'Changed', @@ -292,7 +292,7 @@ 'centralnotice-banner-settings' => "Label for a radio button {{msg-mw|Centralnotice-banner-settings}} and {{msg-mw|Centralnotice-banner-content}} are visible at [{{fullurl:meta:Special:CentralNoticeLogs|log=bannersettings}} Special:CentralNoticeLogs] – ''settings'' chooses between logs for campaigns and log for banners, ''content'' is one of the things which could be changed on a banner (see the details of a log entry). So, I would go with “banners in general” for ''settings'' and “a single banner” in ''content''.", - 'centralnotice-landingcheck' => 'This is a the name of a MediaWiki extension.', + 'centralnotice-autolink' => 'Label for a setting', 'centralnotice-banner-content' => "{{msg-mw|Centralnotice-banner-settings}} and {{msg-mw|Centralnotice-banner-content}} appear to be visible at [{{fullurl:meta:Special:CentralNoticeLogs|log=bannersettings}} Special:CentralNoticeLogs] – ''settings'' chooses between logs for campaigns and log for banners, ''content'' is one of the things which could be changed on a banner (see the details of a log entry). So, I would go with “banners in general” for ''settings'' and “a single banner” in ''content''.", 'centralnotice-filters' => 'Label for a set of options that control filtering of logs', 'centralnotice-date' => 'Label for a date selection interface', Modified: trunk/extensions/CentralNotice/CentralNotice.php =================================================================== --- trunk/extensions/CentralNotice/CentralNotice.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/CentralNotice.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -161,8 +161,8 @@ $base . '/patches/patch-notice_log.sql' ); $wgExtNewTables[] = array( 'cn_template_log', $base . '/patches/patch-template_log.sql' ); - $wgExtNewFields[] = array( 'cn_templates', 'tmp_landingcheck', - $base . '/patches/patch-template_landingcheck.sql' ); + $wgExtNewFields[] = array( 'cn_templates', 'tmp_autolink', + $base . '/patches/patch-template_autolink.sql' ); } } else { if ( $updater->getDB()->getType() == 'mysql' ) { @@ -184,8 +184,8 @@ $base . '/patches/patch-notice_log.sql', true ) ); $updater->addExtensionUpdate( array( 'addTable', 'cn_template_log', $base . '/patches/patch-template_log.sql', true ) ); - $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_landingcheck', - $base . '/patches/patch-template_landingcheck.sql', true ) ); + $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_autolink', + $base . '/patches/patch-template_autolink.sql', true ) ); } } return true; Modified: trunk/extensions/CentralNotice/CentralNoticeBannerLogPager.php =================================================================== --- trunk/extensions/CentralNotice/CentralNoticeBannerLogPager.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/CentralNoticeBannerLogPager.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -151,8 +151,8 @@ )."<br/>"; $details .= wfMsg ( 'centralnotice-log-label', - wfMsg ( 'centralnotice-landingcheck' ), - ($row->tmplog_end_landingcheck ? 'on' : 'off') + wfMsg ( 'centralnotice-autolink' ), + ($row->tmplog_end_autolink ? 'on' : 'off') )."<br/>"; if ( $row->tmplog_end_landingpages ) { $details .= wfMsg ( @@ -170,7 +170,7 @@ $details .= $this->testBooleanChange( 'anon', $row ); $details .= $this->testBooleanChange( 'account', $row ); $details .= $this->testBooleanChange( 'fundraising', $row ); - $details .= $this->testBooleanChange( 'landingcheck', $row ); + $details .= $this->testBooleanChange( 'autolink', $row ); $details .= $this->testTextChange( 'landingpages', $row ); if ( $row->tmplog_content_change ) { // Show changes to banner content Modified: trunk/extensions/CentralNotice/centralnotice.js =================================================================== --- trunk/extensions/CentralNotice/centralnotice.js 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/centralnotice.js 2011-10-07 01:28:31 UTC (rev 99181) @@ -106,12 +106,12 @@ $("#geoMultiSelector").fadeOut('fast'); } }); - // Reveal the LandingCheck interface when the LandingCheck checkbox is checked - $("#landingCheck").click(function () { - if ($('#landingCheck:checked').val() !== undefined) { - $("#landingCheckInterface").fadeIn('fast'); + // Reveal the landing page interface when the autolink checkbox is checked + $("#autolink").click(function () { + if ($('#autolink:checked').val() !== undefined) { + $("#autolinkInterface").fadeIn('fast'); } else { - $("#landingCheckInterface").fadeOut('fast'); + $("#autolinkInterface").fadeOut('fast'); } }); }); Copied: trunk/extensions/CentralNotice/patches/patch-template_autolink.sql (from rev 99175, trunk/extensions/CentralNotice/patches/patch-template_landingcheck.sql) =================================================================== --- trunk/extensions/CentralNotice/patches/patch-template_autolink.sql (rev 0) +++ trunk/extensions/CentralNotice/patches/patch-template_autolink.sql 2011-10-07 01:28:31 UTC (rev 99181) @@ -0,0 +1,8 @@ +-- Update to add a separate flag for automatic link creation + +-- Store a flag indicating whether or not this banner uses automatic link creation +ALTER TABLE /*$wgDBprefix*/cn_templates ADD `tmp_autolink` bool NOT NULL DEFAULT 0 AFTER `tmp_fundraising`; + +-- Store before and after flag values for logging +ALTER TABLE /*$wgDBprefix*/cn_template_log ADD `tmplog_begin_autolink` bool NULL DEFAULT NULL AFTER `tmplog_end_fundraising`; +ALTER TABLE /*$wgDBprefix*/cn_template_log ADD `tmplog_end_autolink` bool NULL DEFAULT NULL AFTER `tmplog_begin_autolink`; \ No newline at end of file Deleted: trunk/extensions/CentralNotice/patches/patch-template_landingcheck.sql =================================================================== --- trunk/extensions/CentralNotice/patches/patch-template_landingcheck.sql 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/patches/patch-template_landingcheck.sql 2011-10-07 01:28:31 UTC (rev 99181) @@ -1,8 +0,0 @@ --- Update to add a separate flag for LandingCheck - --- Store a flag indicating whether or not this banner uses LandingCheck -ALTER TABLE /*$wgDBprefix*/cn_templates ADD `tmp_landingcheck` bool NOT NULL DEFAULT 0 AFTER `tmp_fundraising`; - --- Store before and after flag values for logging -ALTER TABLE /*$wgDBprefix*/cn_template_log ADD `tmplog_begin_landingcheck` bool NULL DEFAULT NULL AFTER `tmplog_end_fundraising`; -ALTER TABLE /*$wgDBprefix*/cn_template_log ADD `tmplog_end_landingcheck` bool NULL DEFAULT NULL AFTER `tmplog_begin_landingcheck`; \ No newline at end of file Modified: trunk/extensions/CentralNotice/special/SpecialBannerController.php =================================================================== --- trunk/extensions/CentralNotice/special/SpecialBannerController.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/special/SpecialBannerController.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -161,7 +161,7 @@ $script = <<<JAVASCRIPT function insertBanner(bannerJson) { jQuery( 'div#centralNotice' ).prepend( bannerJson.bannerHtml ); - if ( bannerJson.landingCheck ) { + if ( bannerJson.autolink ) { JAVASCRIPT; $script .= "\n\t\tvar url = '" . Xml::escapeJsString( $wgNoticeFundraisingUrl ) . "';\n"; Modified: trunk/extensions/CentralNotice/special/SpecialBannerLoader.php =================================================================== --- trunk/extensions/CentralNotice/special/SpecialBannerLoader.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/special/SpecialBannerLoader.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -75,7 +75,7 @@ 'bannerHtml' => $bannerHtml, 'campaign' => $this->campaign, 'fundraising' => $this->getFundraising( $bannerName ), - 'landingCheck' => $this->getLandingCheck( $bannerName ), + 'autolink' => $this->getAutolink( $bannerName ), 'landingPages' => $this->getLandingPages( $bannerName ) ); $bannerJs = 'insertBanner('.FormatJson::encode( $bannerArray ).');'; @@ -204,12 +204,12 @@ return $row->tmp_fundraising; } - function getLandingCheck( $bannerName ) { + function getAutolink( $bannerName ) { global $wgCentralDBname; $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); $eBannerName = htmlspecialchars( $bannerName ); - $row = $dbr->selectRow( 'cn_templates', 'tmp_landingcheck', array( 'tmp_name' => $eBannerName ) ); - return $row->tmp_landingcheck; + $row = $dbr->selectRow( 'cn_templates', 'tmp_autolink', array( 'tmp_name' => $eBannerName ) ); + return $row->tmp_autolink; } function getLandingPages( $bannerName ) { Modified: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php =================================================================== --- trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php 2011-10-07 01:15:53 UTC (rev 99180) +++ trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php 2011-10-07 01:28:31 UTC (rev 99181) @@ -90,7 +90,7 @@ $wgRequest->getBool( 'displayAnon' ), $wgRequest->getBool( 'displayAccount' ), $wgRequest->getBool( 'fundraising' ), - $wgRequest->getBool( 'landingCheck' ), + $wgRequest->getBool( 'autolink' ), $wgRequest->getVal( 'landingPages' ) ); $sub = 'view'; @@ -107,7 +107,7 @@ $wgRequest->getBool( 'displayAnon' ), $wgRequest->getBool( 'displayAccount' ), $wgRequest->getBool( 'fundraising' ), - $wgRequest->getBool( 'landingCheck' ), + $wgRequest->getBool( 'autolink' ), $wgRequest->getVal( 'landingPages' ) ); $sub = 'view'; @@ -240,7 +240,7 @@ $displayAnon = $wgRequest->getCheck( 'displayAnon' ); $displayAccount = $wgRequest->getCheck( 'displayAccount' ); $fundraising = $wgRequest->getCheck( 'fundraising' ); - $landingCheck = $wgRequest->getCheck( 'landingCheck' ); + $autolink = $wgRequest->getCheck( 'autolink' ); $landingPages = $wgRequest->getVal( 'landingPages' ); $body = $wgRequest->getVal( 'templateBody' ); } else { // Use default values @@ -248,7 +248,7 @@ $displayAnon = true; $displayAccount = true; $fundraising = false; - $landingCheck = false; + $autolink = false; $landingPages = ''; $body = ''; } @@ -279,15 +279,15 @@ $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), 'fundraising' ); $htmlOut .= Html::closeElement( 'p' ); - // Checkbox for whether or not to use the LandingCheck extension + // Checkbox for whether or not to automatically create landing page link $htmlOut .= Html::openElement( 'p', null ); - $htmlOut .= Xml::check( 'landingCheck', $landingCheck, array( 'id' => 'landingCheck' ) ); - $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-autolink' ), 'landingCheck' ); + $htmlOut .= Xml::check( 'autolink', $autolink, array( 'id' => 'autolink' ) ); + $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-autolink' ), 'autolink' ); $htmlOut .= Html::closeElement( 'p' ); // Interface for setting the landing pages $htmlOut .= Html::openElement( 'div', - array( 'id' => 'landingCheckInterface', 'style' => 'display: none;' ) ); + array( 'id' => 'autolinkInterface', 'style' => 'display: none;' ) ); $htmlOut .= Xml::tags( 'p', array(), wfMsg( 'centralnotice-banner-autolink-help', 'id="cn-landingpage-link"', 'JimmyAppeal01' ) ); $htmlOut .= Xml::tags( 'p', array(), @@ -563,14 +563,14 @@ $displayAnon = $wgRequest->getCheck( 'displayAnon' ); $displayAccount = $wgRequest->getCheck( 'displayAccount' ); $fundraising = $wgRequest->getCheck( 'fundraising' ); - $landingCheck = $wgRequest->getCheck( 'landingCheck' ); + $autolink = $wgRequest->getCheck( 'autolink' ); $landingPages = $wgRequest->getVal( 'landingPages' ); $body = $wgRequest->getVal( 'templateBody', $body ); } else { // Use previously stored values $displayAnon = ( $bannerSettings['anon'] == 1 ); $displayAccount = ( $bannerSettings['account'] == 1 ); $fundraising = ( $bannerSettings['fundraising'] == 1 ); - $landingCheck = ( $bannerSettings['landingcheck'] == 1 ); + $autolink = ( $bannerSettings['autolink'] == 1 ); $landingPages = $bannerSettings['landingpages']; // $body default is defined prior to message interface code } @@ -598,20 +598,20 @@ 'fundraising' ); $htmlOut .= Html::closeElement( 'p' ); - // Checkbox for whether or not to use the LandingCheck extension + // Checkbox for whether or not to automatically create landing page link $htmlOut .= Html::openElement( 'p', null ); - $htmlOut .= Xml::check( 'landingCheck', $landingCheck, - wfArrayMerge( $disabled, array( 'id' => 'landingCheck' ) ) ); + $htmlOut .= Xml::check( 'autolink', $autolink, + wfArrayMerge( $disabled, array( 'id' => 'autolink' ) ) ); $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-autolink' ), - 'landingCheck' ); + 'autolink' ); $htmlOut .= Html::closeElement( 'p' ); // Interface for setting the landing pages - if ( $landingCheck ) { - $htmlOut .= Html::openElement( 'div', array( 'id'=>'landingCheckInterface' ) ); + if ( $autolink ) { + $htmlOut .= Html::openElement( 'div', array( 'id'=>'autolinkInterface' ) ); } else { $htmlOut .= Html::openElement( 'div', - array( 'id'=>'landingCheckInterface', 'style'=>'display:none;' ) ); + array( 'id'=>'autolinkInterface', 'style'=>'display:none;' ) ); } $htmlOut .= Xml::tags( 'p', array(), wfMsg( 'centralnotice-banner-autolink-help', 'id="cn-landingpage-link"', 'JimmyAppeal01' ) ); @@ -810,12 +810,12 @@ * @param $displayAnon integer flag for display to anonymous users * @param $displayAccount integer flag for display to logged in users * @param $fundraising integer flag for fundraising banner (optional) - * @param $landingCheck integer flag for using LandingCheck (optional) + * @param $autolink integer flag for automatically creating landing page links (optional) * @param $landingPages string list of landing pages (optional) * @return true or false depending on whether banner was successfully added */ public function addTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising = 0, - $landingCheck = 0, $landingPages = '' ) { + $autolink = 0, $landingPages = '' ) { if ( $body == '' || $name == '' ) { $this->showError( 'centralnotice-null-string' ); @@ -844,7 +844,7 @@ 'tmp_display_anon' => $displayAnon, 'tmp_display_account' => $displayAccount, 'tmp_fundraising' => $fundraising, - 'tmp_landingcheck' => $landingCheck, + 'tmp_autolink' => $autolink, 'tmp_landing_pages' => $landingPages ), __METHOD__ @@ -863,7 +863,7 @@ 'anon' => $displayAnon, 'account' => $displayAccount, 'fundraising' => $fundraising, - 'landingcheck' => $landingCheck, + 'autolink' => $autolink, 'landingpages' => $landingPages ); $this->logBannerChange( 'created', $bannerId, $beginSettings, $endSettings ); @@ -876,7 +876,7 @@ * Update a banner */ private function editTemplate( $name, $body, $displayAnon, $displayAccount, $fundraising, - $landingCheck, $landingPages ) { + $autolink, $landingPages ) { if ( $body == '' || $name == '' ) { $this->showError( 'centralnotice-null-string' ); @@ -898,7 +898,7 @@ 'tmp_display_anon' => $displayAnon, 'tmp_display_account' => $displayAccount, 'tmp_fundraising' => $fundraising, - 'tmp_landingcheck' => $landingCheck, + 'tmp_autolink' => $autolink, 'tmp_landing_pages' => $landingPages ), array( 'tmp_name' => $name ) @@ -945,7 +945,7 @@ 'tmp_display_anon', 'tmp_display_account', 'tmp_fundraising', - 'tmp_landingcheck', + 'tmp_autolink', 'tmp_landing_pages' ), array( 'tmp_name' => $source ), @@ -954,7 +954,7 @@ $displayAnon = $row->tmp_display_anon; $displayAccount = $row->tmp_display_account; $fundraising = $row->tmp_fundraising; - $landingCheck = $row->tmp_landingcheck; + $autolink = $row->tmp_autolink; $landingPages = $row->tmp_landing_pages; // Pull banner text and respect any inc: markup @@ -963,7 +963,7 @@ // Create new banner if ( $this->addTemplate( $dest, $template_body, $displayAnon, $displayAccount, $fundraising, - $landingCheck, $landingPages ) ) { + $autolink, $landingPages ) ) { // Populate the fields foreach ( $langs as $lang => $fields ) { _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs