Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -156,6 +156,13 @@ |
157 | 157 | 'dependencies' => 'jquery.tipsy' |
158 | 158 | ) + $commonModuleInfo; |
159 | 159 | |
| 160 | +// Revision 'scapmap': |
| 161 | +$wgResourceModules['ext.codereview.overview'] = array( |
| 162 | + 'scripts' => 'ext.codereview.overview.js', |
| 163 | + 'styles' => 'ext.codereview.overview.css', |
| 164 | + 'dependencies' => 'jquery.tipsy' |
| 165 | +) + $commonModuleInfo; |
| 166 | + |
160 | 167 | // If you are running a closed svn, fill the following two lines with the username and password |
161 | 168 | // of a user allowed to access it. Otherwise, leave it false. |
162 | 169 | // 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.overview.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.overview.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 84 | + native |
Index: trunk/extensions/CodeReview/modules/ext.codereview.overview.js |
— | — | @@ -0,0 +1,142 @@ |
| 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 | +jQuery( function( $ ) { |
| 13 | + // check if we're on a page with a useful list of revisions |
| 14 | + if( $( '#path' ).size() && $('table.TablePager').size() ) { |
| 15 | + var portlet = $( '#p-namespaces' ).size() ? 'p-namespaces' : 'p-cactions'; |
| 16 | + mw.util.addPortletLink( |
| 17 | + portlet, |
| 18 | + '#', |
| 19 | + 'Overview', |
| 20 | + 'ca-scapmap', |
| 21 | + 'Show a graphical overview of this list.', |
| 22 | + '1', |
| 23 | + '' // Nextnode, needs to be defined but we actually don't care |
| 24 | + ); |
| 25 | + } |
| 26 | + |
| 27 | + $('#ca-scapmap').click( function () { |
| 28 | + var $tr = $('table.TablePager tr'); |
| 29 | + if( $tr.size() < 2 ){ |
| 30 | + return; |
| 31 | + } else if( $('#overviewmap').size() ) { |
| 32 | + // We've already created it; maybe they just want to toggle it on and off |
| 33 | + $('#overviewmap').slideToggle(); |
| 34 | + return; |
| 35 | + } |
| 36 | + |
| 37 | + var overviewPopupData = {}; |
| 38 | + |
| 39 | + $( '#contentSub' ).after( $( '<div id="overviewmap">' ) ); |
| 40 | + $( '#overviewmap' ).slideUp( 0 ); |
| 41 | + |
| 42 | + var vpath = $( '#path' ).val(); |
| 43 | + var totals = {}; |
| 44 | + $tr.each( function( i ){ |
| 45 | + var live = 'notlive'; |
| 46 | + var status = false; |
| 47 | + |
| 48 | + var trc = $(this).attr( 'class' ).split(' '); |
| 49 | + if( !trc.length ) { |
| 50 | + return; |
| 51 | + } |
| 52 | + for( var j = 0; j < trc.length; j++ ) { |
| 53 | + // WMF doesn't use live/not live ATM |
| 54 | + // if( /mw\-codereview\-(not|)live/.test( trc[j] ) ) |
| 55 | + // live = trc[j].substring( 14 ); |
| 56 | + if( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) { |
| 57 | + status = trc[j].substring( 21 ); |
| 58 | + } |
| 59 | + } |
| 60 | + var $td = $( 'td', $(this) ); |
| 61 | + |
| 62 | + var statusname = $td.filter( '.TablePager_col_cr_status' ).text(); |
| 63 | + |
| 64 | + if( !statusname || !status || !live ) { |
| 65 | + return; |
| 66 | + } |
| 67 | + |
| 68 | + var rev = $td.filter( '.TablePager_col_cr_id, .TablePager_col_cp_rev_id' ).text(); |
| 69 | + overviewPopupData[i] = { |
| 70 | + 'status' : status, |
| 71 | + 'statusname' : statusname, |
| 72 | + 'notes' : $td.filter( '.TablePager_col_comments' ).text(), |
| 73 | + 'author' : $td.filter( '.TablePager_col_cr_author' ).text(), |
| 74 | + 'rev' : rev |
| 75 | + }; |
| 76 | + |
| 77 | + var path = $td.filter( '.TablePager_col_cr_path' ).text(); |
| 78 | + if( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) { |
| 79 | + path = '\u2026' + path.substring( vpath.length ); |
| 80 | + } |
| 81 | + overviewPopupData[i]['path'] = path; |
| 82 | + |
| 83 | + //overviewPopupData[i]['live'] = live; |
| 84 | + if( !totals[statusname] ) { |
| 85 | + totals[statusname] = 0; |
| 86 | + } |
| 87 | + //if( !totals[live] ) { |
| 88 | + // totals[live] = 0; |
| 89 | + //} |
| 90 | + totals[statusname]++; |
| 91 | + //totals[live]++; |
| 92 | + |
| 93 | + $(this).attr( 'id', 'TablePager-row-' + rev ); |
| 94 | + |
| 95 | + $td.filter( '.TablePager_col_selectforchange' ) |
| 96 | + .append( $( '<a href="#box-' + i + '" class="overview-backlink">^</a>' ) ); |
| 97 | + |
| 98 | + var $box = $( '<a href="#TablePager-row-' + rev + '" class="box-status-' + status + '" id="box-' + i + '"> </a>' ); |
| 99 | + // $box.append( document.createTextNode( live ) ); |
| 100 | + $( '#overviewmap' ).append( $box ); |
| 101 | + }); |
| 102 | + |
| 103 | + var sumtext = []; |
| 104 | + for( var i in totals ) { |
| 105 | + if( typeof i != 'string' || typeof totals[i] != 'number' ) { |
| 106 | + continue; |
| 107 | + } |
| 108 | + sumtext.push( i + ': ' + totals[i] ); |
| 109 | + } |
| 110 | + sumtext.sort(); |
| 111 | + var $summary = $( '<div class="summary">' ) |
| 112 | + .text( 'Total revisions: ' + ( $tr.size() - 1 ) + '. [' + sumtext.join(', ') + ']' ); |
| 113 | + |
| 114 | + $( '#overviewmap' ) |
| 115 | + .append( $summary ) |
| 116 | + .css( 'max-width', Math.floor( Math.sqrt( $tr.size() ) ) * 30 ) |
| 117 | + .slideDown(); |
| 118 | + |
| 119 | + // Add the hover popup |
| 120 | + $( '#overviewmap > a' ) |
| 121 | + .mouseenter( function () { |
| 122 | + |
| 123 | + var $el = $( this ); |
| 124 | + if ( $el.data('overviewPopup') ) { |
| 125 | + return; // already processed |
| 126 | + } |
| 127 | + $el.tipsy( { fade: true, gravity: 'sw', html:true } ); |
| 128 | + var id = parseInt( $(this).attr( 'id' ).replace( /box\-/i, '' ) ); |
| 129 | + |
| 130 | + var $popup = $( '<div id="overviewpop">' + |
| 131 | + '<div>Rev: r<span id="overviewpop-rev">' + overviewPopupData[id]['rev'] + |
| 132 | + '</span> (<span id="overviewpop-status">' + overviewPopupData[id]['status'] + '</span>)</div>' + |
| 133 | + '<div>Number of notes: <span id="overviewpop-notes">' + overviewPopupData[id]['notes'] + '</span></div>' + |
| 134 | + '<div>Path: <span id="overviewpop-path">' + overviewPopupData[id]['path'] + '</span></div>' + |
| 135 | + '<div>Author: r<span id="overviewpop-author">' + overviewPopupData[id]['author'] + '</span></div>' + |
| 136 | + //'<div>Live: <span id="overviewpop-live">' + overviewPopupData[id]['live'] + '</span></div>' + |
| 137 | + '</div>') |
| 138 | + $el.attr( 'title', $popup.html() ); |
| 139 | + $el.data( 'codeTooltip', true ); |
| 140 | + $el.tipsy( 'show' ); |
| 141 | + }); |
| 142 | + }); |
| 143 | +} ); |
Property changes on: trunk/extensions/CodeReview/modules/ext.codereview.overview.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 144 | + native |
Index: trunk/extensions/CodeReview/ui/CodeView.php |
— | — | @@ -151,4 +151,10 @@ |
152 | 152 | $s .= "</tr>\n"; |
153 | 153 | return $s; |
154 | 154 | } |
| 155 | + |
| 156 | + function getStartBody() { |
| 157 | + global $wgOut; |
| 158 | + $wgOut->addModules( 'ext.codereview.overview' ); |
| 159 | + return parent::getStartBody(); |
| 160 | + } |
155 | 161 | } |