r79343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79342‎ | r79343 | r79344 >
Date:15:56, 31 December 2010
Author:platonides
Status:ok
Tags:
Comment:
MFT r78161 and r78511, incorrectly stated as merged in r79129.
Only r78161's phase3/skins/common/block.js was.
Modified paths:
  • /branches/REL1_17/extensions/CheckUser/CheckUser.php (modified) (history)
  • /branches/REL1_17/extensions/CheckUser/CheckUser_body.php (modified) (history)
  • /branches/REL1_17/extensions/CheckUser/checkuser.js (modified) (history)
  • /branches/REL1_17/extensions/Vector/modules/ext.vector.collapsibleNav.css (modified) (history)
  • /branches/REL1_17/extensions/Vector/modules/ext.vector.collapsibleTabs.js (modified) (history)
  • /branches/REL1_17/extensions/Vector/modules/ext.vector.simpleSearch.js (modified) (history)
  • /branches/REL1_17/extensions/Vector/modules/images/arrow-down.png (deleted) (history)
  • /branches/REL1_17/extensions/Vector/modules/images/arrow-left.png (deleted) (history)
  • /branches/REL1_17/extensions/Vector/modules/images/arrow-right.png (deleted) (history)
  • /branches/REL1_17/extensions/Vector/modules/images/closed-ltr.png (added) (history)
  • /branches/REL1_17/extensions/Vector/modules/images/closed-rtl.png (added) (history)
  • /branches/REL1_17/extensions/Vector/modules/images/open.png (added) (history)

Diff [purge]

Index: branches/REL1_17/extensions/Vector/modules/ext.vector.collapsibleNav.css
@@ -1,39 +1,26 @@
22 /* Prototype code to show collapsing left nav options */
33 #mw-panel.collapsible-nav div.portal {
44 /* @embed */
5 - background-image:url(images/portal-break.png?1);
 5+ background-image:url(images/portal-break.png);
66 background-position:left top;
77 background-repeat:no-repeat;
88 padding: 0.25em 0 !important;
99 margin: -11px 9px 10px 11px;
1010 }
11 -body.rtl #mw-panel.collapsible-nav div.portal {
12 - background-position: right top;
13 - margin: -11px 11px 10px 9px;
14 -}
1511 #mw-panel.collapsible-nav div.portal h5 {
1612 color: #4D4D4D;
1713 font-weight: normal;
1814 /* @embed */
19 - background: url(images/arrow-down.png?1) 0 50% no-repeat;
 15+ background: url(images/open.png) left center no-repeat;
2016 padding: 4px 0 3px 1.5em;
2117 margin-bottom: 0px;
2218 }
23 -body.rtl #mw-panel.collapsible-nav div.portal h5 {
24 - /* @embed */
25 - background: url(images/arrow-down.png?1) 100% 50% no-repeat;
26 - padding: 4px 1.5em 3px 0;
27 -}
2819 #mw-panel.collapsible-nav div.collapsed h5 {
2920 color: #0645AD;
3021 /* @embed */
31 - background: url(images/arrow-right.png?1) 0 50% no-repeat;
 22+ background: url(images/closed-ltr.png) left center no-repeat;
3223 margin-bottom: 0px;
3324 }
34 -body.rtl #mw-panel.collapsible-nav div.collapsed h5 {
35 - /* @embed */
36 - background: url(images/arrow-left.png?1) 100% 50% no-repeat;
37 -}
3825 #mw-panel.collapsible-nav div h5:hover {
3926 cursor: pointer;
4027 text-decoration: none;
@@ -66,8 +53,4 @@
6754 }
6855 #mw-panel.collapsible-nav div.persistent div.body {
6956 margin-left: 0.5em;
70 -}
71 -body.rtl #mw-panel.collapsible-nav div.persistent div.body {
72 - margin-left: 0;
73 - margin-right: 0.5em;
74 -}
 57+}
\ No newline at end of file
Index: branches/REL1_17/extensions/Vector/modules/images/arrow-down.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/REL1_17/extensions/Vector/modules/images/arrow-left.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/REL1_17/extensions/Vector/modules/images/arrow-right.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/REL1_17/extensions/Vector/modules/images/open.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: branches/REL1_17/extensions/Vector/modules/images/open.png
___________________________________________________________________
Added: svn:mime-type
7558 + image/png
Index: branches/REL1_17/extensions/Vector/modules/images/closed-ltr.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: branches/REL1_17/extensions/Vector/modules/images/closed-ltr.png
___________________________________________________________________
Added: svn:mime-type
7659 + image/png
Index: branches/REL1_17/extensions/Vector/modules/images/closed-rtl.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: branches/REL1_17/extensions/Vector/modules/images/closed-rtl.png
___________________________________________________________________
Added: svn:mime-type
7760 + image/png
Property changes on: branches/REL1_17/extensions/Vector/modules/ext.vector.simpleSearch.js
___________________________________________________________________
Modified: svn:mergeinfo
7861 Merged /trunk/extensions/Vector/modules/ext.vector.simpleSearch.js:r78161,78511
Property changes on: branches/REL1_17/extensions/Vector/modules/ext.vector.collapsibleTabs.js
___________________________________________________________________
Modified: svn:mergeinfo
7962 Merged /trunk/extensions/Vector/modules/ext.vector.collapsibleTabs.js:r78161,78511
Index: branches/REL1_17/extensions/CheckUser/CheckUser_body.php
@@ -115,7 +115,7 @@
116116 }
117117 # Add CIDR calculation convenience form
118118 $this->addJsCIDRForm();
119 - $this->addStyles();
 119+ $wgOut->addModules( 'ext.checkUser' ); // JS
120120 }
121121
122122 /**
@@ -204,16 +204,6 @@
205205 }
206206
207207 /**
208 - * Add CSS/JS
209 - */
210 - protected function addStyles() {
211 - global $wgScriptPath, $wgCheckUserStyleVersion, $wgOut;
212 - // FIXME, use Html::
213 - $encJSFile = htmlspecialchars( "$wgScriptPath/extensions/CheckUser/checkuser.js?$wgCheckUserStyleVersion" );
214 - $wgOut->addScript( "<script type=\"text/javascript\" src=\"$encJSFile\"></script>" );
215 - }
216 -
217 - /**
218208 * Get a selector of time period options
219209 * @param int $selected, selected level
220210 */
Index: branches/REL1_17/extensions/CheckUser/CheckUser.php
@@ -61,7 +61,6 @@
6262 $wgCheckUserStyleVersion = 5;
6363
6464 # Recent changes data hook
65 -global $wgHooks;
6665 $wgHooks['RecentChange_save'][] = 'efUpdateCheckUserData';
6766 $wgHooks['EmailUser'][] = 'efUpdateCUEmailData';
6867 $wgHooks['User::mailPasswordInternal'][] = 'efUpdateCUPasswordResetData';
@@ -71,6 +70,15 @@
7271 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCheckUserSchemaUpdates';
7372 $wgHooks['ContributionsToolLinks'][] = 'efLoadCheckUserLink';
7473
 74+$wgResourceModules['ext.checkUser'] = array(
 75+ 'scripts' => 'checkuser.js',
 76+ 'dependencies' => array( 'mediawiki.legacy.block' ), // IP stuff
 77+ 'localBasePath' => dirname( __FILE__ ),
 78+ 'remoteExtPath' => 'CheckUser',
 79+);
 80+
 81+// TODO: move hooks to CheckUser.hooks.php
 82+
7583 /**
7684 * Hook function for RecentChange_save
7785 * Saves user data into the cu_changes table
Index: branches/REL1_17/extensions/CheckUser/checkuser.js
@@ -6,7 +6,7 @@
77 * This function calculates the common range of a list of
88 * IPs. It should be set to update on keyUp.
99 */
10 -function updateCIDRresult() {
 10+window.updateCIDRresult = function() {
1111 var form = document.getElementById( 'mw-checkuser-cidrform' );
1212 if( !form ) {
1313 return; // no JS form
@@ -20,7 +20,7 @@
2121 // Each line should have one IP or range
2222 if( text.indexOf("\n") != -1 ) {
2323 var ips = text.split("\n");
24 - // Try some other delimiters too
 24+ // Try some other delimiters too...
2525 } else if( text.indexOf("\t") != -1 ) {
2626 var ips = text.split("\t");
2727 } else if( text.indexOf(",") != -1 ) {
@@ -35,24 +35,29 @@
3636 var bin_prefix = 0;
3737 var prefix_cidr = 0;
3838 var prefix = new String( '' );
 39+ var foundV4 = false;
 40+ var foundV6 = false;
3941 // Go through each IP in the list, get its binary form, and
4042 // track the largest binary prefix among them...
4143 for( var i = 0; i < ips.length; i++ ) {
4244 var invalid = false;
4345 // ...in the spirit of block.js, call this "addy"
44 - var addy = ips[i];
45 - // @TODO: get some core JS IP functions
 46+ var addy = ips[i].replace(/^\s*|\s*$/, '' ); // trim
4647 // Match the first IP in each list (ignore other garbage)
47 - var ipV4 = addy.match(/(^|\b)(\d+\.\d+\.\d+\.\d+)(\/\d+)?\b/);
48 - // Regexp has 3 cases: (starts with '::',ends with '::',neither)
49 - var ipV6 = !addy.match(/::.*::/) // not ambiguous
50 - && addy.match(/(^|\b)(:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(::?[0-9A-Fa-f]{1,4}){0,6}::|[0-9A-Fa-f]{1,4}(::?[0-9A-Fa-f]{1,4}){1,7})(\/\d+)?\b/);
 48+ var ipV4 = isIPv4Address( addy, true ); // from block.js
 49+ var ipV6 = isIPv6Address( addy, true ); // from block.js
 50+ var ip_cidr = addy.match(/^(.*)(?:\/(\d+))?$/);
5151 // Binary form
5252 var bin = new String( '' );
5353 // Convert the IP to binary form: IPv4
5454 if( ipV4 ) {
55 - var ip = ipV4[2];
56 - var cidr = ipV4[3]; // CIDR, if it exists
 55+ foundV4 = true;
 56+ if ( foundV6 ) { // disjoint address space
 57+ prefix = '';
 58+ break;
 59+ }
 60+ var ip = ip_cidr[1];
 61+ var cidr = ip_cidr[2] ? ip_cidr[2] : null; // CIDR, if it exists
5762 // Get each quad integer
5863 var blocs = ip.split('.');
5964 // IANA 1.0.0.0/8, 2.0.0.0/8
@@ -77,7 +82,6 @@
7883 prefix = ''; // Rebuild formatted bin_prefix for each IP
7984 // Apply any valid CIDRs
8085 if( cidr ) {
81 - cidr = cidr.match( /\d+$/ )[0]; // get rid of slash
8286 bin = bin.substring( 0, cidr ); // truncate bin
8387 }
8488 // Init bin_prefix
@@ -122,14 +126,15 @@
123127 }
124128 // Convert the IP to binary form: IPv6
125129 } else if( ipV6 ) {
126 - var ip = ipV6[2];
127 - var cidr = ipV6[0].match( /\/\d+$/ );
128 - cidr = cidr ? cidr[0] : false;
129 - var abbrevs = ip.match( /::/g );
130 - if( abbrevs && abbrevs.length > 1 ) {
131 - continue; // bad IP!
 130+ foundV6 = true;
 131+ if ( foundV4 ) { // disjoint address space
 132+ prefix = '';
 133+ break;
132134 }
 135+ var ip = ip_cidr[1];
 136+ var cidr = ip_cidr[2] ? ip_cidr[2] : null; // CIDR, if it exists
133137 // Expand out "::"s
 138+ var abbrevs = ip.match( /::/g );
134139 if( abbrevs && abbrevs.length > 0 ) {
135140 var colons = ip.match( /:/g );
136141 var needed = 7 - ( colons.length - 2 ); // 2 from "::"
@@ -139,7 +144,8 @@
140145 needed--;
141146 }
142147 ip = ip.replace( '::', insert + ':' );
143 - // For IPs that start with "::", correct the final IP so that it starts with '0' and not ':'
 148+ // For IPs that start with "::", correct the final IP
 149+ // so that it starts with '0' and not ':'
144150 if( ip[0] == ':' ) {
145151 ip = '0' + ip;
146152 }
@@ -165,7 +171,6 @@
166172 prefix = ''; // Rebuild formatted bin_prefix for each IP
167173 // Apply any valid CIDRs
168174 if( cidr ) {
169 - cidr = cidr.match( /\d+$/ )[0]; // get rid of slash
170175 bin = bin.substring( 0, cidr ); // truncate bin
171176 }
172177 // Init bin_prefix
@@ -228,7 +233,7 @@
229234 addOnloadHook( updateCIDRresult );
230235
231236 // Utility function to convert hex to integers
232 -function hex2int( hex ) {
 237+window.hex2int = function( hex ) {
233238 hex = new String( hex );
234239 hex = hex.toLowerCase();
235240 var intform = 0;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78161*Follow-up r78099,r76275:...aaron00:16, 10 December 2010
r78511Fixed right-to-left issues. This also depends on the patch to ResourceLoader ...tparscal19:32, 16 December 2010
r79129MFT r78011 r78014 r78015 r78016 r78099 r78117 r78161 r78170 r78172 r78199 r78......platonides19:58, 28 December 2010

Status & tagging log