r94181 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94180‎ | r94181 | r94182 >
Date:18:41, 10 August 2011
Author:preilly
Status:ok
Tags:
Comment:
add opt-in and opt-out for testing on production
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.i18n.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/views/information/optin.html.php (added) (history)
  • /trunk/extensions/MobileFrontend/views/information/optout.html.php (added) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.i18n.php
@@ -44,6 +44,16 @@
4545 'mobile-frontend-wml-continue' => 'Continue ...',
4646 'mobile-frontend-wml-back' => 'Back ...',
4747 'mobile-frontend-view' => 'Mobile view',
 48+ 'mobile-frontend-opt-in-message' => 'Join our opt-in testing of the new mobile frontend?',
 49+ 'mobile-frontend-opt-in-yes-button' => 'yes',
 50+ 'mobile-frontend-opt-in-no-button' => 'no',
 51+ 'mobile-frontend-opt-in-title' => 'Opt-In for Testing',
 52+ 'mobile-frontend-opt-in-explain' => 'This allows you to enter the test',
 53+ 'mobile-frontend-opt-out-message' => 'Leave opt-in testing of the new mobile frontend?',
 54+ 'mobile-frontend-opt-out-yes-button' => 'yes',
 55+ 'mobile-frontend-opt-out-no-button' => 'no',
 56+ 'mobile-frontend-opt-out-title' => 'Opt-Out of Testing',
 57+ 'mobile-frontend-opt-out-explain' => 'This allows you to leave the test',
4858 );
4959
5060 /** Moroccan Spoken Arabic (Maġribi) */
Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -49,7 +49,7 @@
5050 $wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( &$wgExtMobileFrontend, 'addMobileFooter' );
5151
5252 class ExtMobileFrontend {
53 - const VERSION = '0.5.11';
 53+ const VERSION = '0.5.12';
5454
5555 /**
5656 * @var DOMDocument
@@ -131,18 +131,28 @@
132132 $copyright = $skin->getCopyright();
133133 // Need to stash the results of the "wfMsg" call before the Output Buffering handler
134134 // because at this point the database connection is shut down, etc.
135 - self::$messages['mobile-frontend-show'] = wfMsg( 'mobile-frontend-show-button' );
136 - self::$messages['mobile-frontend-hide'] = wfMsg( 'mobile-frontend-hide-button' );
137 - self::$messages['mobile-frontend-back-to-top'] = wfMsg( 'mobile-frontend-back-to-top-of-section' );
138 - self::$messages['mobile-frontend-regular-site'] = wfMsg( 'mobile-frontend-regular-site' );
139 - self::$messages['mobile-frontend-perm-stop-redirect'] = wfMsg( 'mobile-frontend-perm-stop-redirect' );
140 - self::$messages['mobile-frontend-copyright'] = $copyright;
141 - self::$messages['mobile-frontend-home-button'] = wfMsg( 'mobile-frontend-home-button' );
142 - self::$messages['mobile-frontend-random-button'] = wfMsg( 'mobile-frontend-random-button' );
143 - self::$messages['mobile-frontend-are-you-sure'] = wfMsg( 'mobile-frontend-are-you-sure' );
144 - self::$messages['mobile-frontend-explain-disable'] = wfMsg( 'mobile-frontend-explain-disable' );
145 - self::$messages['mobile-frontend-disable-button'] = wfMsg( 'mobile-frontend-disable-button' );
146 - self::$messages['mobile-frontend-back-button'] = wfMsg( 'mobile-frontend-back-button' );
 135+ self::$messages['mobile-frontend-show'] = wfMsg( 'mobile-frontend-show-button' );
 136+ self::$messages['mobile-frontend-hide'] = wfMsg( 'mobile-frontend-hide-button' );
 137+ self::$messages['mobile-frontend-back-to-top'] = wfMsg( 'mobile-frontend-back-to-top-of-section' );
 138+ self::$messages['mobile-frontend-regular-site'] = wfMsg( 'mobile-frontend-regular-site' );
 139+ self::$messages['mobile-frontend-perm-stop-redirect'] = wfMsg( 'mobile-frontend-perm-stop-redirect' );
 140+ self::$messages['mobile-frontend-copyright'] = $copyright;
 141+ self::$messages['mobile-frontend-home-button'] = wfMsg( 'mobile-frontend-home-button' );
 142+ self::$messages['mobile-frontend-random-button'] = wfMsg( 'mobile-frontend-random-button' );
 143+ self::$messages['mobile-frontend-are-you-sure'] = wfMsg( 'mobile-frontend-are-you-sure' );
 144+ self::$messages['mobile-frontend-explain-disable'] = wfMsg( 'mobile-frontend-explain-disable' );
 145+ self::$messages['mobile-frontend-disable-button'] = wfMsg( 'mobile-frontend-disable-button' );
 146+ self::$messages['mobile-frontend-back-button'] = wfMsg( 'mobile-frontend-back-button' );
 147+ self::$messages['mobile-frontend-opt-in-message'] = wfMsg( 'mobile-frontend-opt-in-message' );
 148+ self::$messages['mobile-frontend-opt-in-yes-button'] = wfMsg( 'mobile-frontend-opt-in-yes-button' );
 149+ self::$messages['mobile-frontend-opt-in-no-button'] = wfMsg( 'mobile-frontend-opt-in-no-button' );
 150+ self::$messages['mobile-frontend-opt-in-title'] = wfMsg( 'mobile-frontend-opt-in-title' );
 151+ self::$messages['mobile-frontend-opt-out-message'] = wfMsg( 'mobile-frontend-opt-out-message' );
 152+ self::$messages['mobile-frontend-opt-out-yes-button'] = wfMsg( 'mobile-frontend-opt-out-yes-button' );
 153+ self::$messages['mobile-frontend-opt-out-no-button'] = wfMsg( 'mobile-frontend-opt-out-no-button' );
 154+ self::$messages['mobile-frontend-opt-out-title'] = wfMsg( 'mobile-frontend-opt-out-title' );
 155+ self::$messages['mobile-frontend-opt-in-explain'] = wfMsg( 'mobile-frontend-opt-in-explain' );
 156+ self::$messages['mobile-frontend-opt-out-explain'] = wfMsg( 'mobile-frontend-opt-out-explain' );
147157
148158 self::$dir = $wgContLang->getDir();
149159 self::$code = $wgContLang->getCode();
@@ -251,6 +261,28 @@
252262 exit();
253263 }
254264 }
 265+
 266+ if ( $mAction == 'opt_in_mobile_site' ) {
 267+ if ( $this->contentFormat == 'XHTML' ) {
 268+ echo $this->renderOptInMobileSiteXHTML();
 269+ exit();
 270+ }
 271+ }
 272+
 273+ if ( $mAction == 'opt_out_mobile_site' ) {
 274+ if ( $this->contentFormat == 'XHTML' ) {
 275+ echo $this->renderOptOutMobileSiteXHTML();
 276+ exit();
 277+ }
 278+ }
 279+
 280+ if ( $mAction == 'opt_in_cookie' ) {
 281+ $wgRequest->response()->setcookie( 'optin', '1' );
 282+ }
 283+
 284+ if ( $mAction == 'opt_out_cookie' ) {
 285+ $wgRequest->response()->setcookie( 'optin', '' );
 286+ }
255287
256288 // Note: Temporarily disabling this section for trial deployment
257289 // if ( is_array($props) &&
@@ -306,6 +338,58 @@
307339 header( 'Pragma: no-cache' );
308340 }
309341 }
 342+
 343+ private function renderOptInMobileSiteXHTML() {
 344+ if ( $this->contentFormat == 'XHTML' ) {
 345+ $this->getMsg();
 346+ $dir = self::$dir;
 347+ $code = self::$code;
 348+ $regularSite = self::$messages['mobile-frontend-regular-site'];
 349+ $permStopRedirect = self::$messages['mobile-frontend-perm-stop-redirect'];
 350+ $copyright = self::$messages['mobile-frontend-copyright'];
 351+ $homeButton = self::$messages['mobile-frontend-home-button'];
 352+ $randomButton = self::$messages['mobile-frontend-random-button'];
 353+ $yesButton = self::$messages['mobile-frontend-opt-in-yes-button'];
 354+ $noButton = self::$messages['mobile-frontend-opt-in-no-button'];
 355+ $htmlTitle = self::$messages['mobile-frontend-opt-in-title'];
 356+ $explainOptIn = self::$messages['mobile-frontend-opt-in-explain'];
 357+ $optInMessage = self::$messages['mobile-frontend-opt-in-message'];
 358+ $cssFileName = ( isset( self::$device['css_file_name'] ) ) ? self::$device['css_file_name'] : 'default';
 359+ require( 'views/layout/_search_webkit.html.php' );
 360+ require( 'views/layout/_footmenu_default.html.php' );
 361+ require( 'views/information/optin.html.php' );
 362+ $contentHtml = $optInHtml;
 363+ require( 'views/layout/application.html.php' );
 364+ return $applicationHtml;
 365+ }
 366+ return '';
 367+ }
 368+
 369+ private function renderOptOutMobileSiteXHTML() {
 370+ if ( $this->contentFormat == 'XHTML' ) {
 371+ $this->getMsg();
 372+ $dir = self::$dir;
 373+ $code = self::$code;
 374+ $regularSite = self::$messages['mobile-frontend-regular-site'];
 375+ $permStopRedirect = self::$messages['mobile-frontend-perm-stop-redirect'];
 376+ $copyright = self::$messages['mobile-frontend-copyright'];
 377+ $homeButton = self::$messages['mobile-frontend-home-button'];
 378+ $randomButton = self::$messages['mobile-frontend-random-button'];
 379+ $yesButton = self::$messages['mobile-frontend-opt-out-yes-button'];
 380+ $noButton = self::$messages['mobile-frontend-opt-out-no-button'];
 381+ $htmlTitle = self::$messages['mobile-frontend-opt-out-title'];
 382+ $explainOptOut = self::$messages['mobile-frontend-opt-out-explain'];
 383+ $optOutMessage = self::$messages['mobile-frontend-opt-out-message'];
 384+ $cssFileName = ( isset( self::$device['css_file_name'] ) ) ? self::$device['css_file_name'] : 'default';
 385+ require( 'views/layout/_search_webkit.html.php' );
 386+ require( 'views/layout/_footmenu_default.html.php' );
 387+ require( 'views/information/optout.html.php' );
 388+ $contentHtml = $optOutHtml;
 389+ require( 'views/layout/application.html.php' );
 390+ return $applicationHtml;
 391+ }
 392+ return '';
 393+ }
310394
311395 private function renderDisableMobileSiteXHTML() {
312396 if ( $this->contentFormat == 'XHTML' ) {
@@ -324,7 +408,6 @@
325409 $htmlTitle = $areYouSure;
326410 $title = $areYouSure;
327411 $cssFileName = ( isset( self::$device['css_file_name'] ) ) ? self::$device['css_file_name'] : 'default';
328 - require( 'views/notices/_donate.html.php' );
329412 require( 'views/layout/_search_webkit.html.php' );
330413 require( 'views/layout/_footmenu_default.html.php' );
331414 require( 'views/information/disable.html.php' );
Index: trunk/extensions/MobileFrontend/views/information/optin.html.php
@@ -0,0 +1,18 @@
 2+<?php
 3+$optInHtml = <<<EOT
 4+ <h1>
 5+ {$optInMessage}
 6+ </h1>
 7+ <p>
 8+ {$explainOptIn}
 9+ </p>
 10+ <div id='disableButtons'>
 11+ <form action='/' method='get'>
 12+ <input name='mAction' type='hidden' value='opt_in_cookie' />
 13+ <button id='disableButton' type='submit'>{$yesButton}</button>
 14+ </form>
 15+ <form action='/' method='get'>
 16+ <button id='backButton' type='submit'>{$noButton}</button>
 17+ </form>
 18+ </div>
 19+EOT;
Property changes on: trunk/extensions/MobileFrontend/views/information/optin.html.php
___________________________________________________________________
Added: svn:eol-style
120 + native
Index: trunk/extensions/MobileFrontend/views/information/optout.html.php
@@ -0,0 +1,18 @@
 2+<?php
 3+$optOutHtml = <<<EOT
 4+ <h1>
 5+ {$optOutMessage}
 6+ </h1>
 7+ <p>
 8+ {$explainOptOut}
 9+ </p>
 10+ <div id='disableButtons'>
 11+ <form action='/' method='get'>
 12+ <input name='mAction' type='hidden' value='opt_out_cookie' />
 13+ <button id='disableButton' type='submit'>{$yesButton}</button>
 14+ </form>
 15+ <form action='/' method='get'>
 16+ <button id='backButton' type='submit'>{$noButton}</button>
 17+ </form>
 18+ </div>
 19+EOT;
Property changes on: trunk/extensions/MobileFrontend/views/information/optout.html.php
___________________________________________________________________
Added: svn:eol-style
120 + native

Status & tagging log