r112222 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112221‎ | r112222 | r112223 >
Date:17:12, 23 February 2012
Author:maxsem
Status:ok
Tags:
Comment:
Killed all the vestiges of server-side expandable sections after r112208
Modified paths:
  • /trunk/extensions/MobileFrontend/ApiParseExtender.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFormatter.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFormatter.php
@@ -19,7 +19,6 @@
2020 */
2121 protected $title;
2222
23 - protected $expandableSections = false;
2423 protected $mainPage = false;
2524
2625 private $headings = 0;
@@ -121,10 +120,6 @@
122121 return $this->format;
123122 }
124123
125 - public function enableExpandableSections( $flag = true ) {
126 - $this->expandableSections = $flag;
127 - }
128 -
129124 public function setIsMainPage( $value = true ) {
130125 $this->mainPage = $value;
131126 }
@@ -274,7 +269,7 @@
275270
276271 switch ( $this->format ) {
277272 case 'XHTML':
278 - if ( $this->expandableSections && !$this->mainPage && strlen( $html ) > 4000 ) {
 273+ if ( !$this->mainPage && strlen( $html ) > 4000 ) {
279274 $html = $this->headingTransform( $html );
280275 }
281276 break;
@@ -339,15 +334,12 @@
340335 '↑' . $backToTop ) .
341336 Html::closeElement( 'div' );
342337 // generate the HTML we are going to inject
343 - if ( $this->expandableSections ) {
344 - $base .= Html::openElement( 'h2',
345 - array( 'class' => 'section_heading',
346 - 'id' => 'section_' . $this->headings ) );
347 - } else {
348 - $base .= Html::openElement( 'h2',
349 - array( 'class' => 'section_heading',
350 - 'id' => 'section_' . $this->headings ) );
351 - }
 338+ $base .= Html::openElement( 'h2',
 339+ array(
 340+ 'class' => 'section_heading',
 341+ 'id' => 'section_' . $this->headings
 342+ )
 343+ );
352344 $base .=
353345 Html::rawElement( 'span',
354346 array( 'id' => $headlineId ),
Index: trunk/extensions/MobileFrontend/ApiParseExtender.php
@@ -15,7 +15,6 @@
1616 $params['mobileformat'] = array(
1717 ApiBase::PARAM_TYPE => array( 'wml', 'html' ),
1818 );
19 - $params['expandablesections'] = false;
2019 $params['noimages'] = false;
2120 $params['mainpage'] = false;
2221 }
@@ -31,8 +30,6 @@
3231 public static function onAPIGetParamDescription( ApiBase &$module, &$params ) {
3332 if ( $module->getModuleName() == 'parse' ) {
3433 $params['mobileformat'] = 'Return parse output in a format suitable for mobile devices';
35 - $params['expandablesections'] = 'Make sections in mobile output collapsed by default, expandable via JavaScript.'
36 - . " Ignored if `section' parameter is set.";
3734 $params['noimages'] = 'Disable images in mobile output';
3835 $params['mainpage'] = 'Apply mobile main page transformations';
3936 }
@@ -47,7 +44,7 @@
4845 */
4946 public static function onAPIGetDescription( ApiBase &$module, &$desc ) {
5047 if ( $module->getModuleName() == 'parse' ) {
51 - $desc= (array)$desc;
 48+ $desc = (array)$desc;
5249 $desc[] = 'Extended by MobileFrontend';
5350 }
5451 return true;
@@ -80,18 +77,8 @@
8178 ExtMobileFrontend::parseContentFormat( $params['mobileformat'] ),
8279 $context
8380 );
84 - if ( $params['expandablesections'] ) {
85 - if ( isset( $params['section'] ) ) {
86 - $module->setWarning( "`expandablesections' and `section' can't be used simultaneously" );
87 - } elseif ( !$title->isMainPage() ) {
88 - $mf->enableExpandableSections();
89 - }
90 - }
9181 $mf->removeImages( $params['noimages'] );
9282 $mf->setIsMainPage( $params['mainpage'] );
93 - if ( $params['mainpage'] && $params['expandablesections'] ) {
94 - $module->setWarning( "`mainpage' and `expandablesections' can't be used simultaneously" );
95 - }
9683 $mf->filterContent();
9784 $data['parse']['text'] = $mf->getText( 'content' );
9885
Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php
@@ -18,7 +18,6 @@
1919 public static $mainPageUrl;
2020 public static $randomPageUrl;
2121 public static $format;
22 - public static $search;
2322 public static $callback;
2423 public static $useFormat;
2524 public static $disableImages;
@@ -469,7 +468,6 @@
470469 self::$format = $wgRequest->getText( 'format' );
471470 self::$callback = $wgRequest->getText( 'callback' );
472471 $this->wmlContext->setRequestedSegment( $wgRequest->getInt( 'seg', 0 ) );
473 - self::$search = $wgRequest->getText( 'search' );
474472 self::$searchField = $wgRequest->getText( 'search', '' );
475473
476474 $device = new DeviceDetection();
@@ -1112,11 +1110,6 @@
11131111 $prepend = '<p><input emptyok="true" format="*M" type="text" name="search" value="" size="16" />' .
11141112 '<do type="accept" label="' . self::$messages['mobile-frontend-search-submit'] . '">' .
11151113 '<go href="' . $wgScript . '?title=Special%3ASearch&amp;search=$(search)"></go></do></p>';
1116 - } elseif ( $this->contentFormat == 'XHTML'
1117 - && self::$device['supports_javascript'] === true
1118 - && empty( self::$search ) )
1119 - {
1120 - $formatter->enableExpandableSections();
11211114 }
11221115 $contentHtml = $formatter->getText( 'content', $prepend );
11231116

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112208use javascript to generate buttons for expandable sections...jdlrobson15:26, 23 February 2012

Status & tagging log