r84687 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84686‎ | r84687 | r84688 >
Date:17:05, 24 March 2011
Author:happy-melon
Status:reverted (Comments)
Tags:
Comment:
Integrate scapmap into CodeReview core.
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/modules/ext.codereview.css (modified) (history)
  • /trunk/extensions/CodeReview/modules/ext.codereview.scapmap.css (added) (history)
  • /trunk/extensions/CodeReview/modules/ext.codereview.scapmap.js (added) (history)
  • /trunk/extensions/CodeReview/ui/CodeView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -155,6 +155,13 @@
156156 'dependencies' => 'jquery.tipsy'
157157 ) + $commonModuleInfo;
158158
 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+
159166 // If you are running a closed svn, fill the following two lines with the username and password
160167 // of a user allowed to access it. Otherwise, leave it false.
161168 // This is only necessary if using the shell method to access Subversion
Index: trunk/extensions/CodeReview/modules/ext.codereview.css
@@ -7,6 +7,7 @@
88 overflow:auto;
99 }
1010
 11+.TablePager_col_selectforchange,
1112 .TablePager_col_comments {
1213 text-align: center;
1314 }
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
184 + 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
1139 + native
Index: trunk/extensions/CodeReview/ui/CodeView.php
@@ -139,4 +139,10 @@
140140 $s .= "</tr>\n";
141141 return $s;
142142 }
 143+
 144+ function getStartBody() {
 145+ global $wgOut;
 146+ $wgOut->addModules( 'ext.codereview.scapmap' );
 147+ return parent::getStartBody();
 148+ }
143149 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r84751Per IRC cabal: revert r84687 (integrate scapmap to CodeReview)....demon15:29, 25 March 2011
r86490Restore r84687 (reverted in r84751). Now with a few extra features:...happy-melon16:28, 20 April 2011

Comments

#Comment by 😂 (talk | contribs)   15:17, 25 March 2011

Does the scapmap even work anymore since we moved to wmf branches?

#Comment by Happy-melon (talk | contribs)   16:00, 25 March 2011

This hardly seems much of a cabal consensus:

[15:17:16] <codurr>	New code comment: ^demon; Does the scapmap even work anymore since we moved to wmf branches?; <[http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84687#c15413 http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84687#c15413]>
[15:17:41] <Reedy>	^demon, I killed the live parts etc
[15:17:56] <hexmode>	but later, so feel free to review if I don't
[15:17:58] <hexmode>	:)
[15:19:45] <^demon>	Reedy: Actually tbh, it's pretty wmf-specific, probably would be fine to just remain as a gadget.
[15:19:57] <Reedy>	true
[15:20:52] <^demon>	So probably we can just revert that.
[15:20:52] <Reedy>	I don't actually think the gadget even works atm...
[15:22:00] <codurr>	�03ialex� * <[http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84749 http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84749]> �10�/trunk/extensions/StringFunctionsEscaped/ (StringFunctionsEscaped.i18n.php StringFunctionsEscaped.php)�:�
[15:22:00] <codurr>	* Use a specific file for magic words
[15:22:00] <codurr>	* Use ParserFirstCallInit to register parser functions
[15:22:00] <codurr>	* Use the given Parser object to grab the underlying functions; not $wgParser
[15:22:13] <^demon>	Even less reason to move it to CR :)
[15:22:22] <^demon>	So we should revert.
[15:23:52] <codurr>	�03ialex� * <[http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84750 http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84750]> �10�/trunk/extensions/ (3 files in 3 dirs)�:� Removed some useless extension
[15:23:59] <sprunka>	I'll say hi to everyone. However, I am a lurker. I'm here to listen and learn.
[15:24:07] <hexmode>	^demon: the ones of kaldari's that I could really use help with are gallery-related
[15:24:21] <Reedy>	ialex, think you didn't save the complete commit summary :P
[15:24:41] <hexmode>	sprunka: hey\
[15:25:02] <hexmode>	moar learning
[15:25:16] <codurr>	New code comment: ^demon; ...functions?; <[http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84750#c15414 http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84750#c15414]>
[15:25:22] <Reedy>	:D
[15:25:25] <^demon>	Finished it :p
[15:25:42] *ialex 	hides
[15:29:51] <codurr>	�03demon� * <[http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84751 http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84751]> �10�/trunk/extensions/CodeReview/ (5 files in 3 dirs)�:�
[15:29:51] <codurr>	Per IRC cabal: revert [[Special:Code/MediaWiki/84687|r84687]] (integrate scapmap to CodeReview).
[15:29:51] <codurr>	* It doesn't actually work right now
[15:29:51] <codurr>	* It's pretty wmf-specific
[15:29:51] <codurr>	We want to keep CR pretty clean (looking to do a trunk deploy soon), so let's not add more gadgets to it, k?

The live stuff doesn't work, but the live stuff is commented out. What is in place works perfectly fine, and has absolutely nothing to do with WMF; if detailing which revisions have been reviewed and which haven't is not part of the extension's core functionality, what is? Have you actually looked at what it does recently? I'm fine with leaving it out until we've done the release, but IMO your rationale for reverting is just plain wrong.

#Comment by Hashar (talk | contribs)   16:35, 27 March 2011

I liked this overview, we need it back in code and not as a gadget. CR overall is WMF specific anyway.

#Comment by 😂 (talk | contribs)   16:54, 27 March 2011

Not really, CR works very well outside of the WMF (if you like its workflow :p), and I know a few people use it. The gadget's been fixed on mw.org, we can revisit merging it in once we deploy CR this week.

#Comment by Hashar (talk | contribs)   20:56, 27 March 2011

Great news! Thanks chad

Status & tagging log