r96842 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96841‎ | r96842 | r96843 >
Date:14:42, 12 September 2011
Author:reedy
Status:ok
Tags:
Comment:
REL1_18: MFT r93288, r94212, r96261, r96263, r96384
Modified paths:
  • /branches/REL1_18/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_18/phase3/includes/SkinLegacy.php (modified) (history)
  • /branches/REL1_18/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /branches/REL1_18/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php (modified) (history)
  • /branches/REL1_18/phase3/skins/CologneBlue.php (modified) (history)
  • /branches/REL1_18/phase3/skins/Simple.php (modified) (history)
  • /branches/REL1_18/phase3/skins/Standard.php (modified) (history)
  • /branches/REL1_18/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/skins/Simple.php
@@ -27,12 +27,12 @@
2828 $out->addModuleStyles( 'skins.simple' );
2929
3030 /* Add some userprefs specific CSS styling */
31 - global $wgUser, $wgContLang;
 31+ global $wgUser;
3232 $rules = array();
3333 $underline = "";
3434
3535 if ( $wgUser->getOption( 'underline' ) < 2 ) {
36 - $underline = "text-decoration: " . $wgUser->getOption( 'underline' ) ? 'underline' : 'none' . ";";
 36+ $underline = "text-decoration: " . $wgUser->getOption( 'underline' ) ? 'underline !important' : 'none' . ";";
3737 }
3838
3939 /* Also inherits from resourceloader */
@@ -42,10 +42,7 @@
4343 $rules[] = "a.stub:after { $underline; }";
4444 }
4545 $style = implode( "\n", $rules );
46 - if ( $wgContLang->getDir() === 'rtl' ) {
47 - $style = CSSJanus::transform( $style, true, false );
48 - }
49 - $out->addInlineStyle( $style );
 46+ $out->addInlineStyle( $style, /* flip css if RTL */true );
5047
5148 }
5249 }
Index: branches/REL1_18/phase3/skins/CologneBlue.php
@@ -27,24 +27,24 @@
2828 $rules = array();
2929
3030 if ( 2 == $qb ) { # Right
31 - $rules[] = "#quickbar { position: absolute; right: 4px; }";
32 - $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
 31+ $rules[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }";
 32+ $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }";
3333 } elseif ( 1 == $qb ) {
34 - $rules[] = "#quickbar { position: absolute; left: 4px; }";
35 - $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
 34+ $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }";
 35+ $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }";
3636 } elseif ( 3 == $qb ) { # Floating left
37 - $rules[] = "#quickbar { position:absolute; left:4px }";
38 - $rules[] = "#topbar { margin-left: 148px }";
39 - $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
40 - $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
 37+ $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }";
 38+ $rules[] = "/* @noflip */#topbar { margin-left: 148px }";
 39+ $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }";
 40+ $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE
4141 } elseif ( 4 == $qb ) { # Floating right
42 - $rules[] = "#quickbar { position: fixed; right: 4px; }";
43 - $rules[] = "#topbar { margin-right: 148px }";
44 - $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
45 - $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
 42+ $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }";
 43+ $rules[] = "/* @noflip */#topbar { margin-right: 148px }";
 44+ $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }";
 45+ $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE
4646 }
4747 $style = implode( "\n", $rules );
48 - $out->addInlineStyle( $style );
 48+ $out->addInlineStyle( $style, /* flip css if RTL */true );
4949 }
5050
5151 }
@@ -221,10 +221,12 @@
222222 }
223223 $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
224224 }
225 - foreach ( $browseLinks as $link ) {
226 - if ( $link['text'] != '-' ) {
227 - $s .= "<a href=\"{$link['href']}\">" .
228 - htmlspecialchars( $link['text'] ) . '</a>' . $sep;
 225+ if( is_array( $browseLinks ) ) {
 226+ foreach ( $browseLinks as $link ) {
 227+ if ( $link['text'] != '-' ) {
 228+ $s .= "<a href=\"{$link['href']}\">" .
 229+ htmlspecialchars( $link['text'] ) . '</a>' . $sep;
 230+ }
229231 }
230232 }
231233 $barnumber++;
Index: branches/REL1_18/phase3/skins/Standard.php
@@ -26,21 +26,21 @@
2727 $rules = array();
2828
2929 if ( 2 == $qb ) { # Right
30 - $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
31 - $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
 30+ $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
 31+ $rules[] = "/* @noflip */#article, /* @noflip */#mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
3232 } elseif ( 1 == $qb || 3 == $qb ) {
33 - $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
34 - $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
 33+ $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
 34+ $rules[] = "/* @noflip */#article, /* @noflip */#mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
3535 if( 3 == $qb ) {
36 - $rules[] = "#quickbar { position: fixed; padding: 4px; }";
 36+ $rules[] = "/* @noflip */#quickbar { position: fixed; padding: 4px; }";
3737 }
3838 } elseif ( 4 == $qb ) {
39 - $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
40 - $rules[] = "#quickbar { border-right: 1px solid gray; }";
41 - $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
 39+ $rules[] = "/* @noflip */#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
 40+ $rules[] = "/* @noflip */#quickbar { border-right: 1px solid gray; }";
 41+ $rules[] = "/* @noflip */#article, /* @noflip */#mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
4242 }
4343 $style = implode( "\n", $rules );
44 - $out->addInlineStyle( $style );
 44+ $out->addInlineStyle( $style, /* flip css if RTL */true );
4545 }
4646
4747 }
Index: branches/REL1_18/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
@@ -368,4 +368,87 @@
369369 }
370370 );
371371
 372+test( 'data-sort-value attribute, when available, should override sorting position', function() {
 373+ var $table, data;
 374+
 375+ // Simple example, one without data-sort-value which should be sorted at it's text.
 376+ $table = $(
 377+ '<table class="sortable"><thead><tr><th>Data</th></tr></thead>' +
 378+ '<tbody>' +
 379+ '<tr><td>Cheetah</td></tr>' +
 380+ '<tr><td data-sort-value="Apple">Bird</td></tr>' +
 381+ '<tr><td data-sort-value="Bananna">Ferret</td></tr>' +
 382+ '<tr><td data-sort-value="Drupe">Elephant</td></tr>' +
 383+ '<tr><td data-sort-value="Cherry">Dolphin</td></tr>' +
 384+ '</tbody></table>'
 385+ );
 386+ $table.tablesorter().find( '.headerSort:eq(0)' ).click();
 387+
 388+ data = [];
 389+ $table.find( 'tbody > tr' ).each( function( i, tr ) {
 390+ $( tr ).find( 'td' ).each( function( i, td ) {
 391+ data.push( { data: $( td ).data( 'sort-value' ), text: $( td ).text() } );
 392+ });
 393+ });
 394+
 395+ deepEqual( data, [
 396+ {
 397+ "data": "Apple",
 398+ "text": "Bird"
 399+ }, {
 400+ "data": "Bananna",
 401+ "text": "Ferret"
 402+ }, {
 403+ "data": undefined,
 404+ "text": "Cheetah"
 405+ }, {
 406+ "data": "Cherry",
 407+ "text": "Dolphin"
 408+ }, {
 409+ "data": "Drupe",
 410+ "text": "Elephant"
 411+ }
 412+ ] );
 413+
 414+ // Another example
 415+ $table = $(
 416+ '<table class="sortable"><thead><tr><th>Data</th></tr></thead>' +
 417+ '<tbody>' +
 418+ '<tr><td>D</td></tr>' +
 419+ '<tr><td data-sort-value="E">A</td></tr>' +
 420+ '<tr><td>B</td></tr>' +
 421+ '<tr><td>G</td></tr>' +
 422+ '<tr><td data-sort-value="F">C</td></tr>' +
 423+ '</tbody></table>'
 424+ );
 425+ $table.tablesorter().find( '.headerSort:eq(0)' ).click();
 426+
 427+ data = [];
 428+ $table.find( 'tbody > tr' ).each( function( i, tr ) {
 429+ $( tr ).find( 'td' ).each( function( i, td ) {
 430+ data.push( { data: $( td ).data( 'sort-value' ), text: $( td ).text() } );
 431+ });
 432+ });
 433+
 434+ deepEqual( data, [
 435+ {
 436+ "data": undefined,
 437+ "text": "B"
 438+ }, {
 439+ "data": undefined,
 440+ "text": "D"
 441+ }, {
 442+ "data": "E",
 443+ "text": "A"
 444+ }, {
 445+ "data": "F",
 446+ "text": "C"
 447+ }, {
 448+ "data": undefined,
 449+ "text": "G"
 450+ }
 451+ ] );
 452+
 453+});
 454+
372455 })();
Index: branches/REL1_18/phase3/includes/filerepo/LocalFile.php
@@ -655,6 +655,11 @@
656656 $hashedName = md5( $this->getName() );
657657 $oldKey = $this->repo->getSharedCacheKey( 'oldfile', $hashedName );
658658
 659+ // Must purge thumbnails for old versions too! bug 30192
 660+ foreach( $this->getHistory() as $oldFile ) {
 661+ $oldFile->purgeThumbnails();
 662+ }
 663+
659664 if ( $oldKey ) {
660665 $wgMemc->delete( $oldKey );
661666 }
Property changes on: branches/REL1_18/phase3/includes/filerepo/LocalFile.php
___________________________________________________________________
Modified: svn:mergeinfo
662667 Merged /trunk/phase3/includes/filerepo/LocalFile.php:r93288,94212,96261,96263,96384
Index: branches/REL1_18/phase3/includes/OutputPage.php
@@ -2955,8 +2955,13 @@
29562956 /**
29572957 * Adds inline CSS styles
29582958 * @param $style_css Mixed: inline CSS
 2959+ * @param $flip Boolean: Whether to flip the CSS if needed
29592960 */
2960 - public function addInlineStyle( $style_css ){
 2961+ public function addInlineStyle( $style_css, $flip = false ) {
 2962+ if( $flip && $this->getLang()->isRTL() ) {
 2963+ # If wanted, and the interface is right-to-left, flip the CSS
 2964+ $style_css = CSSJanus::transform( $style_css, true, false );
 2965+ }
29612966 $this->mInlineStyles .= Html::inlineStyle( $style_css );
29622967 }
29632968
Property changes on: branches/REL1_18/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
29642969 Merged /trunk/phase3/includes/OutputPage.php:r93288,94212,96261,96263,96384
Index: branches/REL1_18/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php
@@ -93,7 +93,7 @@
9494 $rules = array();
9595 if ( $options['underline'] < 2 ) {
9696 $rules[] = "a { text-decoration: " .
97 - ( $options['underline'] ? 'underline' : 'none' ) . "; }";
 97+ ( $options['underline'] ? 'underline !important' : 'none' ) . "; }";
9898 }
9999 if ( $options['highlightbroken'] ) {
100100 $rules[] = "a.new, #quickbar a.new { color: #ba0000; }\n";
Index: branches/REL1_18/phase3/includes/SkinLegacy.php
@@ -248,7 +248,7 @@
249249
250250 $s = array(
251251 $this->getSkin()->mainPageLink(),
252 - $this->getSkin()->specialLink( 'Recentchanges' )
 252+ Linker::specialLink( 'Recentchanges' )
253253 );
254254
255255 if ( $wgOut->isArticleRelated() ) {
@@ -501,7 +501,7 @@
502502 }
503503
504504 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
505 - $s[] .= $this->getSkin()->link(
 505+ $s[] .= Linker::link(
506506 $this->getSkin()->getTitle(),
507507 wfMsg( 'currentrev' ),
508508 array(),
@@ -514,7 +514,7 @@
515515 # do not show "You have new messages" text when we are viewing our
516516 # own talk page
517517 if ( !$this->getSkin()->getTitle()->equals( $wgUser->getTalkPage() ) ) {
518 - $tl = $this->getSkin()->link(
 518+ $tl = Linker::link(
519519 $wgUser->getTalkPage(),
520520 wfMsgHtml( 'newmessageslink' ),
521521 array(),
@@ -522,7 +522,7 @@
523523 array( 'known', 'noclasses' )
524524 );
525525
526 - $dl = $this->getSkin()->link(
 526+ $dl = Linker::link(
527527 $wgUser->getTalkPage(),
528528 wfMsgHtml( 'newmessagesdifflink' ),
529529 array(),
@@ -611,7 +611,7 @@
612612 $t = wfMsg( 'viewsource' );
613613 }
614614
615 - $s = $this->getSkin()->link(
 615+ $s = Linker::link(
616616 $this->getSkin()->getTitle(),
617617 $t,
618618 array(),
@@ -631,7 +631,7 @@
632632 if ( $this->getSkin()->getTitle()->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
633633 $t = wfMsg( 'deletethispage' );
634634
635 - $s = $this->getSkin()->link(
 635+ $s = Linker::link(
636636 $this->getSkin()->getTitle(),
637637 $t,
638638 array(),
@@ -659,7 +659,7 @@
660660 $query = array( 'action' => 'protect' );
661661 }
662662
663 - $s = $this->getSkin()->link(
 663+ $s = Linker::link(
664664 $this->getSkin()->getTitle(),
665665 $text,
666666 array(),
@@ -697,7 +697,7 @@
698698 $id = 'mw-watch-link' . $this->mWatchLinkNum;
699699 }
700700
701 - $s = $this->getSkin()->link(
 701+ $s = Linker::link(
702702 $title,
703703 $text,
704704 array( 'id' => $id ),
@@ -713,7 +713,7 @@
714714
715715 function moveThisPage() {
716716 if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
717 - return $this->getSkin()->link(
 717+ return Linker::link(
718718 SpecialPage::getTitleFor( 'Movepage' ),
719719 wfMsg( 'movethispage' ),
720720 array(),
@@ -727,7 +727,7 @@
728728 }
729729
730730 function historyLink() {
731 - return $this->getSkin()->link(
 731+ return Linker::link(
732732 $this->getSkin()->getTitle(),
733733 wfMsgHtml( 'history' ),
734734 array( 'rel' => 'archives' ),
@@ -736,7 +736,7 @@
737737 }
738738
739739 function whatLinksHere() {
740 - return $this->getSkin()->link(
 740+ return Linker::link(
741741 SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
742742 wfMsgHtml( 'whatlinkshere' ),
743743 array(),
@@ -746,7 +746,7 @@
747747 }
748748
749749 function userContribsLink() {
750 - return $this->getSkin()->link(
 750+ return Linker::link(
751751 SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
752752 wfMsgHtml( 'contributions' ),
753753 array(),
@@ -756,7 +756,7 @@
757757 }
758758
759759 function emailUserLink() {
760 - return $this->getSkin()->link(
 760+ return Linker::link(
761761 SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
762762 wfMsg( 'emailuser' ),
763763 array(),
@@ -771,7 +771,7 @@
772772 if ( !$wgOut->isArticleRelated() ) {
773773 return '(' . wfMsg( 'notanarticle' ) . ')';
774774 } else {
775 - return $this->getSkin()->link(
 775+ return Linker::link(
776776 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
777777 wfMsg( 'recentchangeslinked-toolbox' ),
778778 array(),
@@ -832,7 +832,7 @@
833833 $text = wfMsg( 'talkpage' );
834834 }
835835
836 - $s = $this->getSkin()->link( $link, $text, array(), array(), $linkOptions );
 836+ $s = Linker::link( $link, $text, array(), array(), $linkOptions );
837837
838838 return $s;
839839 }
@@ -855,7 +855,7 @@
856856 $title = $this->getSkin()->getTitle()->getTalkPage();
857857 }
858858
859 - return $this->getSkin()->link(
 859+ return Linker::link(
860860 $title,
861861 wfMsg( 'postcomment' ),
862862 array(),
@@ -874,7 +874,7 @@
875875 # Using an empty class attribute to avoid automatic setting of "external" class
876876 return Linker::makeExternalLink( $wgUploadNavigationUrl, wfMsgHtml( 'upload' ), false, null, array( 'class' => '' ) );
877877 } else {
878 - return $this->getSkin()->link(
 878+ return Linker::link(
879879 SpecialPage::getTitleFor( 'Upload' ),
880880 wfMsgHtml( 'upload' ),
881881 array(),
@@ -895,7 +895,7 @@
896896 if ( $this->getSkin()->showIPinHeader() ) {
897897 $name = wfGetIP();
898898
899 - $talkLink = $this->getSkin()->link( $wgUser->getTalkPage(),
 899+ $talkLink = Linker::link( $wgUser->getTalkPage(),
900900 $wgLang->getNsText( NS_TALK ) );
901901
902902 $ret .= "$name ($talkLink)";
@@ -913,30 +913,30 @@
914914 $loginlink = $wgUser->isAllowed( 'createaccount' )
915915 ? 'nav-login-createaccount'
916916 : 'login';
917 - $ret .= "\n<br />" . $this->getSkin()->link(
 917+ $ret .= "\n<br />" . Linker::link(
918918 SpecialPage::getTitleFor( 'Userlogin' ),
919919 wfMsg( $loginlink ), array(), $query
920920 );
921921 } else {
922922 $returnTo = $this->getSkin()->getTitle()->getPrefixedDBkey();
923 - $talkLink = $this->getSkin()->link( $wgUser->getTalkPage(),
 923+ $talkLink = Linker::link( $wgUser->getTalkPage(),
924924 $wgLang->getNsText( NS_TALK ) );
925925
926 - $ret .= $this->getSkin()->link( $wgUser->getUserPage(),
 926+ $ret .= Linker::link( $wgUser->getUserPage(),
927927 htmlspecialchars( $wgUser->getName() ) );
928928 $ret .= " ($talkLink)<br />";
929929 $ret .= $wgLang->pipeList( array(
930 - $this->getSkin()->link(
 930+ Linker::link(
931931 SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
932932 array(), array( 'returnto' => $returnTo )
933933 ),
934 - $this->getSkin()->specialLink( 'Preferences' ),
 934+ Linker::specialLink( 'Preferences' ),
935935 ) );
936936 }
937937
938938 $ret = $wgLang->pipeList( array(
939939 $ret,
940 - $this->getSkin()->link(
 940+ Linker::link(
941941 Title::newFromText( wfMsgForContent( 'helppage' ) ),
942942 wfMsg( 'help' )
943943 ),

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93288SkinLegacy:...robin17:20, 27 July 2011
r94212(bug 30192) Old thumbnails not properly purged. Unlike the bug suggests, we d...demon23:29, 10 August 2011
r96261* Mark underline css as !important. It should override other css (such as the...robin21:50, 4 September 2011
r96263Fix r96261: don't add important if 'none', so it doesn't break underlining on...robin22:05, 4 September 2011
r96384jquery.tablesorter.test: Add tests for data-sort-value...krinkle23:09, 6 September 2011

Status & tagging log