Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -155,6 +155,13 @@ |
156 | 156 | 'dependencies' => 'jquery.tipsy' |
157 | 157 | ) + $commonModuleInfo; |
158 | 158 | |
| 159 | +// Revision 'scapmap': |
| 160 | +$wgResourceModules['ext.codereview.scapmap'] = array( |
| 161 | + 'scripts' => 'ext.codereview.scapmap.js', |
| 162 | + 'styles' => 'ext.codereview.scapmap.css', |
| 163 | + 'dependencies' => 'jquery.tipsy' |
| 164 | +) + $commonModuleInfo; |
| 165 | + |
159 | 166 | // If you are running a closed svn, fill the following two lines with the username and password |
160 | 167 | // of a user allowed to access it. Otherwise, leave it false. |
161 | 168 | // This is only necessary if using the shell method to access Subversion |
Index: trunk/extensions/CodeReview/modules/ext.codereview.css |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | overflow:auto; |
9 | 9 | } |
10 | 10 | |
| 11 | +.TablePager_col_selectforchange, |
11 | 12 | .TablePager_col_comments { |
12 | 13 | text-align: center; |
13 | 14 | } |
Index: trunk/extensions/CodeReview/modules/ext.codereview.scapmap.css |
— | — | @@ -0,0 +1,82 @@ |
| 2 | +#overviewmap { |
| 3 | + border: 1px solid #2F6FAB; |
| 4 | + padding: 2px; |
| 5 | + min-width: 300px; |
| 6 | +} |
| 7 | +#overviewmap #overviewpop { |
| 8 | + padding: 3px; |
| 9 | + border: 1px solid black; |
| 10 | + position: absolute; |
| 11 | + height: 6.5em; |
| 12 | + width: 16em; |
| 13 | + display: none; |
| 14 | + background-color: #ffffdd; |
| 15 | + font-size: 80%; |
| 16 | + line-height: 100%; |
| 17 | + overflow: hidden; |
| 18 | + white-space: pre; |
| 19 | +} |
| 20 | +#overviewmap > a { |
| 21 | + display: block; |
| 22 | + border: 1px solid #888; |
| 23 | + float: left; |
| 24 | + width: 26px; /* 26px for body + 2px for border + 2px for margin = 30px total */ |
| 25 | + height: 26px; |
| 26 | + margin: 1px; |
| 27 | + overflow: hidden; |
| 28 | +} |
| 29 | +#overviewmap > a:target { |
| 30 | + border-style: dashed; |
| 31 | +} |
| 32 | +#overviewmap .summary { |
| 33 | + clear: both; |
| 34 | +} |
| 35 | + |
| 36 | +/** Revision statuses **/ |
| 37 | +.box-status-new { |
| 38 | + background: #ffffc0 !important; |
| 39 | +} |
| 40 | +.box-status-new:hover { |
| 41 | + background: #dfdfa0 !important; |
| 42 | +} |
| 43 | +.box-status-fixme { |
| 44 | + background: #ff9999 !important; |
| 45 | +} |
| 46 | +.box-status-fixme:hover { |
| 47 | + background: #df0000 !important; |
| 48 | +} |
| 49 | +.box-status-resolved { |
| 50 | + background: #b0eeb0 !important; |
| 51 | +} |
| 52 | +.box-status-resolved:hover { |
| 53 | + background: #80ff80 !important; |
| 54 | +} |
| 55 | +.box-status-reverted { |
| 56 | + background: #bbddee !important; |
| 57 | +} |
| 58 | +.box-status-reverted:hover { |
| 59 | + background: #66bbff !important; |
| 60 | +} |
| 61 | +.box-status-deferred { |
| 62 | + background: #dddddd !important; |
| 63 | +} |
| 64 | +.box-status-deferred:hover { |
| 65 | + background: #aaaaaa !important; |
| 66 | +} |
| 67 | + |
| 68 | +.box-live-live { |
| 69 | + border: 1px solid #00ff00 !important; |
| 70 | +} |
| 71 | + |
| 72 | +table.TablePager tr:target { |
| 73 | + font-weight: bold; |
| 74 | +} |
| 75 | + |
| 76 | +.overview-backlink { |
| 77 | + clear:both; |
| 78 | + display: none; |
| 79 | +} |
| 80 | + |
| 81 | +tr:target .overview-backlink { |
| 82 | + display: inline; |
| 83 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/CodeReview/modules/ext.codereview.scapmap.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 84 | + native |
Index: trunk/extensions/CodeReview/modules/ext.codereview.scapmap.js |
— | — | @@ -0,0 +1,137 @@ |
| 2 | +/* Scap roadmap viewer, version [0.0.7] |
| 3 | + * Originally from: http://www.mediawiki.org/wiki/User:Splarka/scapmap.js |
| 4 | + * |
| 5 | + * |
| 6 | + * Loads on, for example: http://www.mediawiki.org/wiki/Special:Code/MediaWiki |
| 7 | + * Click [overview] to generate map. |
| 8 | + * Text in the "path" input box is stripped from the path line in the summary. |
| 9 | + * Clicking a colored box takes you to that relevant line, and a backlink is created in the id column on focus. |
| 10 | + * Hovering over a colored box pops up a little info packet box. |
| 11 | + */ |
| 12 | + |
| 13 | +// check if we're on a page with a useful list of revisions |
| 14 | +( function( $ ) { |
| 15 | + if( $( '#path' ).size() && $('table.TablePager').size() ) { |
| 16 | + mw.util.addPortletLink( |
| 17 | + 'p-cactions', |
| 18 | + '#', |
| 19 | + 'Overview', |
| 20 | + 'ca-scapmap', |
| 21 | + 'Show a graphical overview of this list.', |
| 22 | + '1' |
| 23 | + ); |
| 24 | + } |
| 25 | + |
| 26 | + $('#ca-scapmap').click( function ( $ ) { |
| 27 | + var $tr = $('table.TablePager tr'); |
| 28 | + if( $tr.size() < 2 || $('#overviewmap').size() ) { |
| 29 | + return; |
| 30 | + } |
| 31 | + |
| 32 | + var overviewPopupData = {}; |
| 33 | + |
| 34 | + $( '#contentSub' ).after( $( '<div id="overviewmap">' ) ); |
| 35 | + $( '#overviewmap' ).slideUp( 0 ); |
| 36 | + |
| 37 | + var vpath = $( '#path' ).val(); |
| 38 | + var totals = {}; |
| 39 | + $tr.each( function( i ){ |
| 40 | + var live = 'notlive'; |
| 41 | + var status = false; |
| 42 | + |
| 43 | + var trc = $(this).attr( 'class' ).split(' '); |
| 44 | + if( !trc.length ) { |
| 45 | + return; |
| 46 | + } |
| 47 | + for( var j = 0; j < trc.length; j++ ) { |
| 48 | + // WMF doesn't use live/not live ATM |
| 49 | + // if( /mw\-codereview\-(not|)live/.test( trc[j] ) ) |
| 50 | + // live = trc[j].substring( 14 ); |
| 51 | + if( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) { |
| 52 | + status = trc[j].substring( 21 ); |
| 53 | + } |
| 54 | + } |
| 55 | + var $td = $( 'td', $(this) ); |
| 56 | + |
| 57 | + var statusname = $td.filter( '.TablePager_col_cr_status' ).text(); |
| 58 | + |
| 59 | + if( !statusname || !status || !live ) { |
| 60 | + return; |
| 61 | + } |
| 62 | + |
| 63 | + var rev = $td.filter( '.TablePager_col_cr_id, .TablePager_col_cp_rev_id' ).text(); |
| 64 | + overviewPopupData[i] = { |
| 65 | + 'status' : status, |
| 66 | + 'statusname' : statusname, |
| 67 | + 'notes' : $td.filter( '.TablePager_col_comments' ).text(), |
| 68 | + 'author' : $td.filter( '.TablePager_col_cr_author' ).text(), |
| 69 | + 'rev' : rev |
| 70 | + }; |
| 71 | + |
| 72 | + var path = $td.filter( '.TablePager_col_cr_path' ).text(); |
| 73 | + if( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) { |
| 74 | + path = '\u2026' + path.substring( vpath.length ); |
| 75 | + } |
| 76 | + overviewPopupData[i]['path'] = path; |
| 77 | + |
| 78 | + //overviewPopupData[i]['live'] = live; |
| 79 | + if( !totals[statusname] ) { |
| 80 | + totals[statusname] = 0; |
| 81 | + } |
| 82 | + //if( !totals[live] ) { |
| 83 | + // totals[live] = 0; |
| 84 | + //} |
| 85 | + totals[statusname]++; |
| 86 | + //totals[live]++; |
| 87 | + |
| 88 | + $(this).attr( 'id', 'TablePager-row-' + rev ); |
| 89 | + |
| 90 | + $td.filter( '.TablePager_col_selectforchange' ) |
| 91 | + .append( $( '<a href="#box-' + i + '" class="overview-backlink">^</a>' ) ); |
| 92 | + |
| 93 | + var $box = $( '<a href="#TablePager-row-' + rev + '" class="box-status-' + status + '" id="box-' + i + '"> </a>' ); |
| 94 | + // $box.append( document.createTextNode( live ) ); |
| 95 | + $( '#overviewmap' ).append( $box ); |
| 96 | + }); |
| 97 | + |
| 98 | + var sumtext = []; |
| 99 | + for( var i in totals ) { |
| 100 | + if( typeof i != 'string' || typeof totals[i] != 'number' ) { |
| 101 | + continue; |
| 102 | + } |
| 103 | + sumtext.push( i + ': ' + totals[i] ); |
| 104 | + } |
| 105 | + sumtext.sort(); |
| 106 | + var $summary = $( '<div class="summary">' ) |
| 107 | + .text( 'Total revisions: ' + ( $tr.size() - 1 ) + '. [' + sumtext.join(', ') + ']' ); |
| 108 | + |
| 109 | + $( '#overviewmap' ) |
| 110 | + .append( $summary ) |
| 111 | + .css( 'max-width', Math.floor( Math.sqrt( $tr.size() ) ) * 30 ) |
| 112 | + .slideDown(); |
| 113 | + |
| 114 | + // Add the hover popup |
| 115 | + $( '#overviewmap > a' ) |
| 116 | + .mouseenter( function () { |
| 117 | + |
| 118 | + var $el = $( this ); |
| 119 | + if ( $el.data('overviewPopup') ) { |
| 120 | + return; // already processed |
| 121 | + } |
| 122 | + $el.tipsy( { fade: true, gravity: 'sw', html:true } ); |
| 123 | + var id = parseInt( $(this).attr( 'id' ).replace( /box\-/i, '' ) ); |
| 124 | + |
| 125 | + var $popup = $( '<div id="overviewpop">' + |
| 126 | + '<div>Rev: r<span id="overviewpop-rev">' + overviewPopupData[id]['rev'] + |
| 127 | + '</span> (<span id="overviewpop-status">' + overviewPopupData[id]['status'] + '</span>)</div>' + |
| 128 | + '<div>Number of notes: <span id="overviewpop-notes">' + overviewPopupData[id]['notes'] + '</span></div>' + |
| 129 | + '<div>Path: <span id="overviewpop-path">' + overviewPopupData[id]['path'] + '</span></div>' + |
| 130 | + '<div>Author: r<span id="overviewpop-author">' + overviewPopupData[id]['author'] + '</span></div>' + |
| 131 | + //'<div>Live: <span id="overviewpop-live">' + overviewPopupData[id]['live'] + '</span></div>' + |
| 132 | + '</div>') |
| 133 | + $el.attr( 'title', $popup.html() ); |
| 134 | + $el.data( 'codeTooltip', true ); |
| 135 | + $el.tipsy( 'show' ); |
| 136 | + }); |
| 137 | + }); |
| 138 | +})( jQuery ) ; |
Property changes on: trunk/extensions/CodeReview/modules/ext.codereview.scapmap.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 139 | + native |
Index: trunk/extensions/CodeReview/ui/CodeView.php |
— | — | @@ -139,4 +139,10 @@ |
140 | 140 | $s .= "</tr>\n"; |
141 | 141 | return $s; |
142 | 142 | } |
| 143 | + |
| 144 | + function getStartBody() { |
| 145 | + global $wgOut; |
| 146 | + $wgOut->addModules( 'ext.codereview.scapmap' ); |
| 147 | + return parent::getStartBody(); |
| 148 | + } |
143 | 149 | } |