jenkins-bot has submitted this change and it was merged.
Change subject: Always on banner on special, add a welcome message to the
landing page
......................................................................
Always on banner on special, add a welcome message to the landing page
Thes message is a placeholder that can be easily customized
using wikipedia's MediaWiki namespace messages, or for defaults
on all language sites - in translatewiki. The message will be
parsed as blockparse.
The banner will always be shown on the special page per biz request
The gray blank header at the top is also now hidden via in-code CSS
until mobile designs a way to hide it via some setting.
Removed .mw-mf-banner.mw-mf-banner-undismissable class -- very strange
usage, possibly due to legacy code. Might have to re-add it later if
a bug of some sort surfaces. Removed associated js code.
Change-Id: I944eec59eaf6e83a9828cb284fe8d21274e7151b
---
M ZeroRatedMobileAccess.i18n.php
M includes/PageRenderingHooks.php
M includes/ZeroSpecialPage.php
M modules/banner.css
M modules/banner.js
5 files changed, 44 insertions(+), 32 deletions(-)
Approvals:
Dr0ptp4kt: Looks good to me, approved
Siebrand: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/ZeroRatedMobileAccess.i18n.php b/ZeroRatedMobileAccess.i18n.php
index 5a95c84..1e8b098 100644
--- a/ZeroRatedMobileAccess.i18n.php
+++ b/ZeroRatedMobileAccess.i18n.php
@@ -16,10 +16,11 @@
* @author Yuri Astrakhan (yurik)
*/
$messages['en'] = array (
+ 'zeroratedmobileaccess' => 'Zero Rated Mobile Access',
+ 'zero-landing-welcome' => "<blockquote>Real knowledge never promoted
either turbulence or unbelief; but its progress is the forerunner of liberality
and enlightened toleration.<div style='padding-left: 4em'>— ''Henry
Brougham''</div></blockquote>",
'zero-rated-mobile-access-sorry' => 'Sorry, zero.wikipedia.org is only
supported by select mobile carriers and is not available from your mobile
carrier.',
'zero-rated-mobile-access-sorry-ip' => 'If you are contacting your
mobile carrier, mention that your IP address $1 is not supported.',
'zero-rated-mobile-access-sorry-goto' => 'Go to $1 (standard data
charges may apply)',
- 'zeroratedmobileaccess' => 'Zero Rated Mobile Access',
'zero-rated-mobile-access-desc' => 'Provides features for mobile
providers that provide free access',
'zero-rated-mobile-access-language-selection' => 'All languages',
'zero-rated-mobile-access-home-page-selection' => '$1 home page',
@@ -48,6 +49,9 @@
* @author Siebrand
*/
$messages['qqq'] = array(
+ 'zero-landing-welcome' => "This welcome message is shown at the top of
the landing (starting) page, and should be somewhat different based on
language-specific culture and customs. An example of a message could be:
+
+<blockquote>Real knowledge never promoted either turbulence or unbelief;
but its progress is the forerunner of liberality and enlightened
toleration.<div style='padding-left: 4em'>— ''Henry
Brougham''</div></blockquote>",
'zero-rated-mobile-access-sorry' => 'This message is followed by the
following 2 messages:
* {{msg-mw|Zero-rated-mobile-access-sorry-ip}}
* {{msg-mw|Zero-rated-mobile-access-sorry-goto}}',
diff --git a/includes/PageRenderingHooks.php b/includes/PageRenderingHooks.php
index 6802595..6e7284d 100644
--- a/includes/PageRenderingHooks.php
+++ b/includes/PageRenderingHooks.php
@@ -440,8 +440,9 @@
private function createBanner( $wap = false ) {
global $wgZeroRatedMobileAccessEnableESI;
// fixme: temporary until we stabilize it, then remove
X-FORCE-ESI check
- $esiHeader = $this->request->getHeader( 'X-FORCE-ESI' );
- if ( $wgZeroRatedMobileAccessEnableESI === true || $esiHeader )
{
+ if ( !$this->isZeroSpecial &&
+ ( $wgZeroRatedMobileAccessEnableESI === true ||
$this->request->getHeader( 'X-FORCE-ESI' ) )
+ ) {
# Add an 'Enable-ESI' header for varnish
$this->request->response()->header( 'Enable-ESI: 1' );
@@ -472,7 +473,8 @@
return '';
}
}
- return $this->renderBanner( $config, null, null, $wap,
$this->title->inNamespace( NS_FILE ) );
+ return $this->renderBanner(
+ $config, null, null, $wap, $this->title->inNamespace(
NS_FILE ), $this->isZeroSpecial );
}
/**
@@ -481,9 +483,12 @@
* @param string $sitename
* @param bool $wap
* @param bool $isImage
+ * @param bool $undismissable
* @return string
*/
- public function renderBanner( $config, $langCode, $sitename = null,
$wap = false, $isImage = false ) {
+ public function renderBanner(
+ $config, $langCode, $sitename = null, $wap = false, $isImage =
false, $undismissable = false
+ ) {
if ( $isImage && !$config['showImages'] ) {
return '';
}
@@ -522,15 +527,31 @@
$attr['style'] = $style;
}
$banner = Html::rawElement( 'span', $attr, $banner );
- $dismissTitle = wfMessage(
'zero-rated-mobile-access-dismiss-notification' )->escaped();
- $banner = <<<END
-<div id="zero-rated-banner" class="mw-mf-banner"
style="background:$background;color:$foreground;">
-<button class="notify-close" style="background:$background;"
title="$dismissTitle">
-<span class="notify-close-x"
style="background:$background;border-color:$foreground;color:$foreground;">x</span>
-</button>
-$banner
-</div>
-END;
+ if ( !$undismissable ) {
+ $dismissTitle = wfMessage(
'zero-rated-mobile-access-dismiss-notification' )->escaped();
+ $dismiss = Html::rawElement(
+ 'button',
+ array( 'class' => 'notify-close',
+ 'style' =>
"background:$background;",
+ 'title' => $dismissTitle ),
+ Html::rawElement(
+ 'span',
+ array(
+ 'class' =>
'notify-close-x',
+ 'style' =>
"background:$background;border-color:$foreground;color:$foreground;" ),
+ 'x'
+ )
+ );
+ } else {
+ $dismiss = '';
+ }
+ $banner = Html::rawElement(
+ 'div',
+ array(
+ 'id' => 'zero-rated-banner',
+ 'class' => 'mw-mf-banner',
+ 'style' =>
"background:$background;color:$foreground;" ),
+ $dismiss . $banner );
}
return $banner;
diff --git a/includes/ZeroSpecialPage.php b/includes/ZeroSpecialPage.php
index 1609ba0..c8f7929 100644
--- a/includes/ZeroSpecialPage.php
+++ b/includes/ZeroSpecialPage.php
@@ -113,8 +113,12 @@
*/
private function renderSpecialPage( $config ) {
$output = '';
- $languageNames = Language::fetchLanguageNames();
+ // CSS hack to get rid of the header that comes from the mobile
frontend
+ $output .= '<style type="text/css">.header {display:
none}</style>';
+ $output .= $this->msg( 'zero-landing-welcome' )->parseAsBlock()
. Html::element( 'hr' );
+
+ $languageNames = Language::fetchLanguageNames();
$overrides = $config['langNameOverrides'];
// Allow language name overrides, as requested by Orange Congo
('kg' => 'Kikongo')
// Do it one at a time to keep the original order of the array
diff --git a/modules/banner.css b/modules/banner.css
index 52db2a0..ab77ef9 100644
--- a/modules/banner.css
+++ b/modules/banner.css
@@ -59,19 +59,6 @@
text-align: center;
display: block;
}
-.mw-mf-banner.mw-mf-banner-undismissable {
- color: black;
- background-color: white;
- border-bottom-color: white;
- margin-top: 0.4em;
- margin-bottom: 0.2em;
- line-height: 1.2em;
- font-weight: normal;
-}
-.mw-mf-banner.mw-mf-banner-undismissable a {
- text-decoration: underline;
- color: #ffffff;
-}
.zerobar {
background-color: white !important;
diff --git a/modules/banner.js b/modules/banner.js
index 75411ac..aee6efb 100644
--- a/modules/banner.js
+++ b/modules/banner.js
@@ -29,10 +29,6 @@
function init() {
if ( $ ) {
$( '.mw-mf-banner' ).each( function() {
- if ( $( this ).find( 'button.notify-close'
).length === 0 &&
- !$( this ).hasClass(
'mw-mf-banner-undismissable' ) ) {
- $( '<button class="notify-close">'
).text( '×' ).appendTo( this );
- }
initBanner( this );
} );
}
--
To view, visit https://gerrit.wikimedia.org/r/98464
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I944eec59eaf6e83a9828cb284fe8d21274e7151b
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/ZeroRatedMobileAccess
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: Dr0ptp4kt <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Raimond Spekking <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits