r82533 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82532‎ | r82533 | r82534 >
Date:20:13, 20 February 2011
Author:catrope
Status:resolved
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/RELEASE-NOTES (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/DoubleWiki/DoubleWiki_body.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/ProofreadPage/proofread.js (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.css (modified) (history)
  • /branches/wmf/1.17wmf1/includes/EditPage.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/Import.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/OutputPage.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/libs/CSSMin.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoaderContext.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/specials/SpecialContributions.php (modified) (history)
  • /branches/wmf/1.17wmf1/languages/classes/LanguageWa.php (modified) (history)
  • /branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js (modified) (history)
  • /branches/wmf/1.17wmf1/skins/common/IE80Fixes.css (added) (history)
  • /branches/wmf/1.17wmf1/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/skins/common/IE80Fixes.css
@@ -0,0 +1,15 @@
 2+/**
 3+ * Fixes textarea scrolling bug (bug #19334). The bug only occurs when a
 4+ * percentage width is given, so instead of width: 100%, use min-width: 100%;
 5+ * max-width: 100%. We also need to give a fixed width for the actual width
 6+ * property for the hack to work, although the actual value (500px here) ends
 7+ * up being ignored; min/max-width take precedence.
 8+ *
 9+ * More info: http://grantovich.net/posts/2009/06/that-weird-ie8-textarea-bug/
 10+ */
 11+#wpTextbox1 {
 12+ height: 390px;
 13+ width: 500px;
 14+ min-width: 100%;
 15+ max-width: 100%;
 16+}
Property changes on: branches/wmf/1.17wmf1/skins/common/IE80Fixes.css
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: branches/wmf/1.17wmf1/skins/common/wikibits.js
@@ -620,13 +620,13 @@
621621 for ( var i = 0; i < firstRow.cells.length; i++ ) {
622622 var cell = firstRow.cells[i];
623623 if ( (' ' + cell.className + ' ').indexOf(' unsortable ') == -1 ) {
624 - cell.innerHTML += '<a href="#" class="sortheader" '
 624+ $(cell).append ( '<a href="#" class="sortheader" '
625625 + 'onclick="ts_resortTable(this);return false;">'
626626 + '<span class="sortarrow">'
627627 + '<img src="'
628628 + ts_image_path
629629 + ts_image_none
630 - + '" alt="&darr;"/></span></a>';
 630+ + '" alt="&darr;"/></span></a>');
631631 }
632632 }
633633 if ( ts_alternate_row_colors ) {
@@ -1041,8 +1041,9 @@
10421042
10431043 updateTooltipAccessKeys( null );
10441044 setupCheckboxShiftClick();
1045 - sortables_init();
10461045
 1046+ jQuery( document ).ready( sortables_init );
 1047+
10471048 // Run any added-on functions
10481049 for ( var i = 0; i < onloadFuncts.length; i++ ) {
10491050 onloadFuncts[i]();
Index: branches/wmf/1.17wmf1/extensions/DoubleWiki/DoubleWiki_body.php
@@ -35,11 +35,15 @@
3636 /*
3737 * Read the list of matched phrases and add tags to the html output.
3838 */
39 - function addMatchingTags ( &$text, $lang ) {
40 - $pattern = "/<div id=\"align-$lang\" style=\"display:none;\">\n<p>([^<]*?)<\/p>\n<\/div>/is";
41 - if( ! preg_match( $pattern, $text, $m ) ) return ;
 39+ function addMatchingTags ( &$text, $lang ) {
 40+ $pattern = "/<div id=\"align-$lang\" style=\"display:none;\"><pre>(.*?)<\/pre>/is";
 41+ $m = array();
 42+ if ( ! preg_match( $pattern, $text, $m ) ) {
 43+ return;
 44+ }
4245 $text = str_replace( $m[1], '', $text );
43 - $line_pattern = "/\s*([^:\n]*?)\s*:\s*([^:\n]*?)\s*\n/i";
 46+ $line_pattern = '/\s*([^:\n]*?)\s*=\s*([^:\n]*?)\s*\n/i';
 47+ $items = array();
4448 preg_match_all( $line_pattern, $m[1], $items, PREG_SET_ORDER );
4549 foreach( $items as $n => $i ) {
4650 $text = str_replace( $i[1], "<span id=\"dw-$n\" title=\"{$i[2]}\"/>".$i[1], $text );
Index: branches/wmf/1.17wmf1/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.css
@@ -241,7 +241,7 @@
242242 }
243243 .wikiEditor-ui-toolbar .section-help .page-table td.cell-syntax,
244244 .wikiEditor-ui-toolbar .section-help .page-table td.syntax {
245 - font-family: monospace;
 245+ font-family: monospace, "Courier New";
246246 }
247247 .wikiEditor-ui-toolbar .section-help .page-table td.syntax,
248248 .wikiEditor-ui-toolbar .section-help .page-table td.cell-syntax,
@@ -267,7 +267,7 @@
268268 color: black;
269269 text-decoration: none;
270270 cursor: pointer;
271 - font-family: monospace;
 271+ font-family: monospace, "Courier New";
272272 font-size: 1.25em;
273273 }
274274 .wikiEditor-ui-toolbar .page-characters div[dir=rtl] span {
Index: branches/wmf/1.17wmf1/extensions/ProofreadPage/ProofreadPage_body.php
@@ -357,19 +357,24 @@
358358 $height = $image->getHeight();
359359 if ( $m[2] ) {
360360 $thumbName = $image->thumbName( array( 'width' => '##WIDTH##', 'page' => $m[3] ) );
 361+ $thumbURL = $image->getThumbUrl( $thumbName );
 362+ $thumbURL = str_replace( '%23', '#', $thumbURL );
 363+ $fullURL = str_replace( '##WIDTH##', "$width", $thumbURL );
361364 } else {
362365 $thumbName = $image->thumbName( array( 'width' => '##WIDTH##' ) );
 366+ $thumbURL = $image->getThumbUrl( $thumbName );
 367+ $thumbURL = str_replace( '%23', '#', $thumbURL );
 368+ $fullURL = $image->getURL();
363369 }
364 - $thumbURL = $image->getThumbUrl( $thumbName );
365 - $thumbURL = str_replace( '%23', '#', $thumbURL );
366370 $scan_link = Html::element( 'a',
367 - array( 'href' => str_replace( '##WIDTH##', "$width", $thumbURL ),
 371+ array( 'href' => $fullURL,
368372 'title' => wfMsg( 'proofreadpage_image' ) ),
369373 wfMsg( 'proofreadpage_image' ) );
370374 } else {
371375 $width = 0;
372376 $height = 0;
373377 $thumbURL = '';
 378+ $fullURL = '';
374379 $scan_link = '';
375380 }
376381
@@ -388,6 +393,7 @@
389394 'proofreadPageHeight' => intval( $height ),
390395 'proofreadPageEditWidth' => $edit_width,
391396 'proofreadPageThumbURL' => $thumbURL,
 397+ 'proofreadPageURL' => $fullURL,
392398 'proofreadPageIsEdit' => intval( $isEdit ),
393399 'proofreadPageIndexLink' => $index_link,
394400 'proofreadPageNextLink' => $next_link,
@@ -601,10 +607,10 @@
602608 $view = ( $i - $offset );
603609 switch( $mode ) {
604610 case 'highroman':
605 - $view = toRoman( $view );
 611+ $view = $this->toRoman( $view );
606612 break;
607613 case 'roman':
608 - $view = strtolower( toRoman( $view ) );
 614+ $view = strtolower( $this->toRoman( $view ) );
609615 break;
610616 case 'normal':
611617 $view = '' . $view;
@@ -857,11 +863,9 @@
858864 if( !$is_q0 ) {
859865 $out .= '<span>{{:MediaWiki:Proofreadpage_pagenum_template|page=' . $text . "|num=$pagenum}}</span>";
860866 }
861 - if( $args["$i"] != null ) {
862 - $out .= '{{#lst:' . $text . '|' . $args["$i"] . '}}';
863 - } elseif( $page == $from && $args['fromsection'] ) {
 867+ if( $page == $from_page && $args['fromsection'] ) {
864868 $out .= '{{#lst:' . $text . '|' . $args['fromsection'] . '}}';
865 - } elseif( $page == $to && $args['tosection'] ) {
 869+ } elseif( $page == $to_page && $args['tosection'] ) {
866870 $out .= '{{#lst:' . $text . '|' . $args['tosection'] . '}}';
867871 } else {
868872 $out .= '{{:' . $text . '}}';
Index: branches/wmf/1.17wmf1/extensions/ProofreadPage/proofread.js
@@ -16,10 +16,15 @@
1717 // enforce quantization: width must be multiple of 100px
1818 var width = 100 * Math.round( requested_width / 100 );
1919 // compare to the width of the image
20 - width = Math.min( width, proofreadPageWidth );
21 - self.DisplayWidth = width;
22 - self.DisplayHeight = width * proofreadPageHeight / proofreadPageWidth;
23 - return proofreadPageThumbURL.replace( '##WIDTH##', '' + width );
 20+ if( width < proofreadPageWidth ) {
 21+ self.DisplayWidth = width;
 22+ self.DisplayHeight = width * proofreadPageHeight / proofreadPageWidth;
 23+ return proofreadPageThumbURL.replace( '##WIDTH##', '' + width );
 24+ } else {
 25+ self.DisplayWidth = proofreadPageWidth;
 26+ self.DisplayHeight = proofreadPageHeight;
 27+ return proofreadPageURL;
 28+ }
2429 }
2530 }
2631
@@ -893,12 +898,8 @@
894899 }
895900
896901 // add CSS classes to the container div
897 - var c = document.getElementById( 'pagequality' );
898 - if( c ) {
899 - c = c.nextSibling;
900 - if( c.className == 'pagetext' ) {
901 - c.className += ' ' + self.proofreadPageCss;
902 - }
 902+ if( self.proofreadPageCss) {
 903+ $( 'div.pagetext' ).addClass( self.proofreadPageCss );
903904 }
904905 }
905906
@@ -947,7 +948,7 @@
948949 if( !proofreadPageAddButtons ) {
949950 f.innerHTML =
950951 ' <input type="hidden" name="wpProofreader" value="' + escapeQuotesHTML( self.proofreadpage_username ) + '">' +
951 - '<input type="hidden" name="quality" value="' + escapeQuotesHTML( self.proofreadpage_quality ) + '" >';
 952+ '<input type="hidden" name="quality" value="' + escapeQuotesHTML( self.proofreadpage_quality +'' ) + '" >';
952953 return;
953954 }
954955
Index: branches/wmf/1.17wmf1/includes/EditPage.php
@@ -340,6 +340,8 @@
341341 if ( $wgUser->getOption( 'uselivepreview', false ) ) {
342342 $wgOut->addModules( 'mediawiki.legacy.preview' );
343343 }
 344+ // Bug #19334: textarea jumps when editing articles in IE8
 345+ $wgOut->addStyle( 'common/IE80Fixes.css', 'screen', 'IE 8' );
344346
345347 $permErrors = $this->getEditPermissionErrors();
346348 if ( $permErrors ) {
Property changes on: branches/wmf/1.17wmf1/includes/EditPage.php
___________________________________________________________________
Modified: svn:mergeinfo
347349 Merged /trunk/phase3/includes/EditPage.php:r78893,78897,78909,82404,82408-82409,82453,82456-82458,82460,82465,82474,82478,82482,82486,82513,82518,82530
Index: branches/wmf/1.17wmf1/includes/OutputPage.php
@@ -2334,7 +2334,7 @@
23352335 // Lazy-load ResourceLoader
23362336 // TODO: Should this be a static function of ResourceLoader instead?
23372337 // TODO: Divide off modules starting with "user", and add the user parameter to them
2338 - $query = array(
 2338+ $baseQuery = array(
23392339 'lang' => $wgLang->getCode(),
23402340 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false',
23412341 'skin' => $skin->getSkinName(),
@@ -2342,10 +2342,10 @@
23432343 );
23442344 // Propagate printable and handheld parameters if present
23452345 if ( $wgRequest->getBool( 'printable' ) ) {
2346 - $query['printable'] = 1;
 2346+ $baseQuery['printable'] = 1;
23472347 }
23482348 if ( $wgRequest->getBool( 'handheld' ) ) {
2349 - $query['handheld'] = 1;
 2349+ $baseQuery['handheld'] = 1;
23502350 }
23512351
23522352 if ( !count( $modules ) ) {
@@ -2381,7 +2381,7 @@
23822382 }
23832383 $links = '';
23842384 foreach ( $groups as $group => $modules ) {
2385 - $query['modules'] = implode( '|', array_keys( $modules ) );
 2385+ $query = $baseQuery;
23862386 // Special handling for user-specific groups
23872387 if ( ( $group === 'user' || $group === 'private' ) && $wgUser->isLoggedIn() ) {
23882388 $query['user'] = $wgUser->getName();
@@ -2677,19 +2677,19 @@
26782678 public function buildCssLinks( $sk ) {
26792679 $ret = '';
26802680 // Add ResourceLoader styles
2681 - // Split the styles into three groups
2682 - $styles = array( 'other' => array(), 'user' => array(), 'site' => array() );
 2681+ // Split the styles into four groups
 2682+ $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array() );
26832683 $resourceLoader = $this->getResourceLoader();
26842684 foreach ( $this->getModuleStyles() as $name ) {
26852685 $group = $resourceLoader->getModule( $name )->getGroup();
2686 - // Modules in groups named "other" or anything different than "user" or "site" will
2687 - // be placed in the "other" group
 2686+ // Modules in groups named "other" or anything different than "user", "site" or "private"
 2687+ // will be placed in the "other" group
26882688 $styles[isset( $styles[$group] ) ? $group : 'other'][] = $name;
26892689 }
26902690
2691 - // We want site and user styles to override dynamically added styles from modules, but we want
 2691+ // We want site, private and user styles to override dynamically added styles from modules, but we want
26922692 // dynamically added styles to override statically added styles from other modules. So the order
2693 - // has to be other, dynamic, site, user
 2693+ // has to be other, dynamic, site, private, user
26942694 // Add statically added styles for other modules
26952695 $ret .= $this->makeResourceLoaderLink( $sk, $styles['other'], 'styles' );
26962696 // Add normal styles added through addStyle()/addInlineStyle() here
@@ -2697,10 +2697,13 @@
26982698 // Add marker tag to mark the place where the client-side loader should inject dynamic styles
26992699 // We use a <meta> tag with a made-up name for this because that's valid HTML
27002700 $ret .= Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) );
2701 - // Add site and user styles
2702 - $ret .= $this->makeResourceLoaderLink(
2703 - $sk, array_merge( $styles['site'], $styles['user'] ), 'styles'
2704 - );
 2701+
 2702+ // Add site, private and user styles
 2703+ // 'private' at present only contains user.options, so put that before 'user'
 2704+ // Any future private modules will likely have a similar user-specific character
 2705+ foreach ( array( 'site', 'private', 'user' ) as $group ) {
 2706+ $ret .= $this->makeResourceLoaderLink( $sk, $styles[$group], 'styles' );
 2707+ }
27052708 return $ret;
27062709 }
27072710
Property changes on: branches/wmf/1.17wmf1/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
27082711 Merged /trunk/phase3/includes/OutputPage.php:r78893,78897,78909,82404,82408-82409,82453,82456-82458,82460,82465,82474,82478,82482,82486,82513,82518,82530
Index: branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoaderContext.php
@@ -131,7 +131,7 @@
132132 }
133133
134134 public function getHash() {
135 - if ( isset( $this->hash ) ) {
 135+ if ( !isset( $this->hash ) ) {
136136 $this->hash = implode( '|', array(
137137 $this->getLanguage(), $this->getDirection(), $this->skin, $this->user,
138138 $this->debug, $this->only, $this->version
Index: branches/wmf/1.17wmf1/includes/libs/CSSMin.php
@@ -120,12 +120,23 @@
121121 self::URL_REGEX . '(?P<post>[^;]*)[\;]?/';
122122 $offset = 0;
123123 while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) {
124 - // Skip absolute URIs and relative URIs with absolute paths
125 - if ( preg_match( '/^(\/|https?:\/\/)/', $match['file'][0] ) ) {
 124+ // Skip absolute URIs
 125+ if ( preg_match( '/^https?:\/\//', $match['file'][0] ) ) {
126126 // Move the offset to the end of the match, leaving it alone
127127 $offset = $match[0][1] + strlen( $match[0][0] );
128128 continue;
129129 }
 130+ // URLs with absolute paths like /w/index.php need to be expanded
 131+ // to absolute URLs but otherwise left alone
 132+ if ( $match['file'][0] !== '' && $match['file'][0][0] === '/' ) {
 133+ // Replace the file path with an expanded URL
 134+ $source = substr_replace( $source, wfExpandUrl( $match['file'][0] ),
 135+ $match['file'][1], strlen( $match['file'][0] )
 136+ );
 137+ // Move the offset to the end of the match, leaving it alone
 138+ $offset = $match[0][1] + strlen( $match[0][0] );
 139+ continue;
 140+ }
130141 // Shortcuts
131142 $embed = $match['embed'][0];
132143 $pre = $match['pre'][0];
Index: branches/wmf/1.17wmf1/includes/specials/SpecialContributions.php
@@ -56,7 +56,7 @@
5757 $this->opts['contribs'] = 'newbie';
5858 }
5959
60 - $this->opts['deletedOnly'] = $wgRequest->getCheck( 'deletedOnly' );
 60+ $this->opts['deletedOnly'] = $wgRequest->getBool( 'deletedOnly' );
6161
6262 if( !strlen( $target ) ) {
6363 $wgOut->addHTML( $this->getForm() );
@@ -65,7 +65,7 @@
6666
6767 $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
6868 $this->opts['target'] = $target;
69 - $this->opts['topOnly'] = $wgRequest->getCheck( 'topOnly' );
 69+ $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' );
7070
7171 $nt = Title::makeTitleSafe( NS_USER, $target );
7272 if( !$nt ) {
Index: branches/wmf/1.17wmf1/includes/Import.php
@@ -662,7 +662,7 @@
663663 return false;
664664 }
665665
666 - return array( $origTitle, $title );
 666+ return array( $title, $origTitle );
667667 }
668668 }
669669
Index: branches/wmf/1.17wmf1/languages/classes/LanguageWa.php
@@ -25,6 +25,7 @@
2626 ## # "<day> d' <monthname>" for months starting with a vowel
2727 ## #
2828 function date( $ts, $adj = false, $format = true, $tc = false ) {
 29+ $ts = wfTimestamp( TS_MW, $ts );
2930 if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
3031 $datePreference = $this->dateFormat( $format );
3132
Index: branches/wmf/1.17wmf1/RELEASE-NOTES
@@ -491,6 +491,7 @@
492492 * (bug 26449) Keep underlines from headings outside of tables and thumbs by
493493 adding overflow:hidden to h1,h2,h3,h4,h5,h6 (also fixes editsection bunching).
494494 * (bug 26708) Remove background-color:white from tables in Monobook and Vector.
 495+* (bug 27560) Search queries no longer fail in walloon language
495496
496497 === API changes in 1.17 ===
497498 * BREAKING CHANGE: action=patrol now requires POST
Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
498499 Merged /trunk/extensions/RELEASE-NOTES:r78893,78897,78909,82404
499500 Merged /trunk/phase3/RELEASE-NOTES:r78893,78897,78909,82404,82408-82409,82453,82456-82458,82460,82465,82474,82478,82482,82486,82513,82518,82530
Index: branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js
@@ -386,7 +386,7 @@
387387 break;
388388 }
389389 var context = $(this).data( 'wikiEditor-context' );
390 - var hasIframe = context !== undefined && context.$iframe !== undefined;
 390+ var hasIframe = typeof context !== 'undefined' && context && typeof context.$iframe !== 'undefined';
391391
392392 // IE selection restore voodoo
393393 var needSave = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r82534Followup r82533: fix botched mergecatrope20:25, 20 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78893using .append() instead of innerHTML+=. The latter replaces the html and caus...krinkle16:36, 23 December 2010
r78897didn't mean to commit thiskrinkle17:50, 23 December 2010
r78909Fix r78897: remove dependency on makeCollapsible as wellcatrope18:38, 23 December 2010
r82404fix bug 27454: confusion between / and /thomasv15:33, 18 February 2011
r82408toRoman is a methodthomasv17:07, 18 February 2011
r82409fix for pagetext cssthomasv17:38, 18 February 2011
r82453fix regression for small images (bug 27536)thomasv14:29, 19 February 2011
r82456Revert r82218 , doesn't fix absolute path URLs but breaks them. Will fix prop...catrope14:46, 19 February 2011
r82457(bug 27328) Redo r82218 properly, expanding URLs with absolute pathscatrope14:58, 19 February 2011
r82458(bug 27502) Monospace text too smallcatrope15:02, 19 February 2011
r82460Force conversion of proofreadpage_quality from number to string....hartman15:20, 19 February 2011
r82465Fix logic error in r73204 (!) causing ResourceLoaderContext::getHash() to alw...catrope16:48, 19 February 2011
r82474Revert r74387: it may not fix the IE8 jumping bug in all cases, but it defini...catrope19:21, 19 February 2011
r82478* (bug 27560) Search queries no longer fail in walloon languageialex20:06, 19 February 2011
r82482All functions of the importer have $title, origTitle, but processTitle() retu...hartman20:35, 19 February 2011
r82486Don't use getCheck, because the opts array is reused to generate the query fo...hartman21:03, 19 February 2011
r82513fix regression in r73461: Use pre tag instead of p. Use equal sign instead of...thomasv16:29, 20 February 2011
r82518(bug 27468) Move private styles out to their own section, so they override ev...catrope17:24, 20 February 2011
r82530(bug 27355) Guard against context being null, this happens when wikiEditor di...catrope19:27, 20 February 2011

Status & tagging log