r106283 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106282‎ | r106283 | r106284 >
Date:23:55, 14 December 2011
Author:preilly
Status:ok
Tags:
Comment:
1.18wmf1: MFT r106269 - r106231
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/FooterTemplate.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/FooterTemplate.php
@@ -27,7 +27,8 @@
2828 $imagesURL = $this->data['enableImagesURL'];
2929 }
3030
31 - $logoutLink = ( !empty( $this->data['logoutHtml'] ) ) ? ' | ' . $this->data['logoutHtml'] : '';
 31+ $logoutLink = ( $this->data['logoutHtml'] ) ? ' | ' . $this->data['logoutHtml'] : '';
 32+ $logoutLink = ( $this->data['loginHtml'] ) ? ' | ' . $this->data['loginHtml'] : $logoutLink;
3233
3334 $feedbackLink = ( $this->data['code'] == 'en' && $this->data['isBetaGroupMember'] ) ? "| <a href=\"{$leaveFeedbackURL}\">{$leaveFeedback}</a>" : '';
3435
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -105,7 +105,7 @@
106106 }
107107
108108 class ExtMobileFrontend {
109 - const VERSION = '0.6.0';
 109+ const VERSION = '0.6.1';
110110
111111 /**
112112 * @var DOMDocument
@@ -151,6 +151,7 @@
152152 public static $wsLoginFormAction = '';
153153 public static $isFilePage;
154154 public static $logoutHtml;
 155+ public static $loginHtml;
155156
156157 public static $messageKeys = array(
157158 'mobile-frontend-show-button',
@@ -306,7 +307,7 @@
307308 $footerlinks = $tpl->data['footerlinks'];
308309 $mobileViewUrl = $wgRequest->escapeAppendQuery( 'useformat=mobile' );
309310
310 - $tpl->set( 'mobileview', "<a href='{$mobileViewUrl}'>" . wfMsg( 'mobile-frontend-view' ) . "</a>" );
 311+ $tpl->set( 'mobileview', "<a href='{$mobileViewUrl}' class='noprint'>" . wfMsg( 'mobile-frontend-view' ) . "</a>" );
311312 $footerlinks['places'][] = 'mobileview';
312313 $tpl->set( 'footerlinks', $footerlinks );
313314 }
@@ -435,8 +436,13 @@
436437 }
437438 $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : '';
438439 $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : '';
439 - $redirect = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path']
440 - . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
 440+ $redirect = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path'];
 441+ if ( isset( $parsedUrl['query'] ) ) {
 442+ $redirect .= $queryDelimiter . $parsedUrl['query'];
 443+ }
 444+ if ( isset( $parsedUrl['fragment'] ) ) {
 445+ $redirect .= $fragmentDelimiter . $parsedUrl['fragment'];
 446+ }
441447 }
442448 }
443449 return true;
@@ -1316,11 +1322,34 @@
13171323
13181324 $itemToRemoveRecords = $this->parseItemsToRemove();
13191325
1320 - $ptLogout = $this->doc->getElementById( 'pt-logout' );
 1326+ if ( self::$isBetaGroupMember ) {
 1327+ $ptLogout = $this->doc->getElementById( 'pt-logout' );
13211328
1322 - if ( $ptLogout ) {
1323 - $ptLogoutLink = $ptLogout->firstChild;
1324 - self::$logoutHtml = $this->doc->saveXML( $ptLogoutLink, LIBXML_NOEMPTYTAG );
 1329+ if ( $ptLogout ) {
 1330+ $ptLogoutLink = $ptLogout->firstChild;
 1331+ self::$logoutHtml = $this->doc->saveXML( $ptLogoutLink, LIBXML_NOEMPTYTAG );
 1332+ }
 1333+
 1334+ $ptAnonLogin = $this->doc->getElementById( 'pt-anonlogin' );
 1335+
 1336+ if ( $ptAnonLogin ) {
 1337+ $ptAnonLoginLink = $ptAnonLogin->firstChild;
 1338+ if ( $ptAnonLoginLink && $ptAnonLoginLink->hasAttributes() ) {
 1339+ $ptAnonLoginLinkHref = $ptAnonLoginLink->getAttributeNode( 'href' );
 1340+ $ptAnonLoginLinkTitle = $ptAnonLoginLink->getAttributeNode( 'title' );
 1341+ if ( $ptAnonLoginLinkTitle ) {
 1342+ $ptAnonLoginLinkTitle->nodeValue = self::$messages['mobile-frontend-login'];
 1343+ }
 1344+ if ( $ptAnonLoginLinkHref ) {
 1345+ $ptAnonLoginLinkHref->nodeValue = str_replace( "&", "&amp;", $ptAnonLoginLinkHref->nodeValue ) . '&amp;useformat=mobile';
 1346+ }
 1347+ $ptAnonLoginLinkText = $ptAnonLoginLink->firstChild;
 1348+ if ( $ptAnonLoginLinkText ) {
 1349+ $ptAnonLoginLinkText->nodeValue = self::$messages['mobile-frontend-login'];
 1350+ }
 1351+ }
 1352+ self::$loginHtml = $this->doc->saveXML( $ptAnonLoginLink, LIBXML_NOEMPTYTAG );
 1353+ }
13251354 }
13261355
13271356 if ( self::$title->isSpecial( 'Userlogin' ) && self::$isBetaGroupMember ) {
@@ -1328,7 +1357,7 @@
13291358
13301359 if ( $userlogin && get_class( $userlogin ) === 'DOMElement' ) {
13311360 $firstHeading = $this->doc->getElementById( 'firstHeading' );
1332 - if ( !empty( $firstHeading ) ) {
 1361+ if ( $firstHeading ) {
13331362 $firstHeading->nodeValue = '';
13341363 }
13351364 }
@@ -1521,7 +1550,8 @@
15221551 public function getFooterTemplate() {
15231552 wfProfileIn( __METHOD__ );
15241553 $footerTemplate = new FooterTemplate();
1525 - $logoutHtml = ( !empty( self::$logoutHtml ) ) ? self::$logoutHtml : '';
 1554+ $logoutHtml = ( self::$logoutHtml ) ? self::$logoutHtml : '';
 1555+ $loginHtml = ( self::$loginHtml ) ? self::$loginHtml : '';
15261556 $options = array(
15271557 'messages' => self::$messages,
15281558 'leaveFeedbackURL' => self::$leaveFeedbackURL,
@@ -1531,6 +1561,7 @@
15321562 'disableImagesURL' => self::$disableImagesURL,
15331563 'enableImagesURL' => self::$enableImagesURL,
15341564 'logoutHtml' => $logoutHtml,
 1565+ 'loginHtml' => $loginHtml,
15351566 'code' => self::$code,
15361567 'isBetaGroupMember' => self::$isBetaGroupMember,
15371568 );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106231add login link for betapreilly19:15, 14 December 2011
r106269add noprint to mobile view linkpreilly22:38, 14 December 2011

Status & tagging log