r59212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59211‎ | r59212 | r59213 >
Date:20:53, 18 November 2009
Author:catrope
Status:deferred
Tags:
Comment:
USabilityInitiative: Add support for versioning toolbar icons
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -71,16 +71,16 @@
7272 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ),
7373 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 20 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 17 ),
75 - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 31 ),
 75+ array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 32 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 38 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 3 ),
7979 ),
8080 'combined' => array(
81 - array( 'src' => 'js/plugins.combined.js', 'version' => 81 ),
 81+ array( 'src' => 'js/plugins.combined.js', 'version' => 82 ),
8282 ),
8383 'minified' => array(
84 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 81 ),
 84+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 82 ),
8585 ),
8686 ),
8787 );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.php
@@ -28,6 +28,9 @@
2929
3030 /* Setup */
3131
 32+// Bump this each time you change an icon without renaming it
 33+$wgWikiEditorIconVersion = 0;
 34+
3235 // Credits
3336 $wgExtensionCredits['other'][] = array(
3437 'path' => __FILE__,
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -25,6 +25,11 @@
2626 ),
2727 );
2828 static $modules = array(
 29+ 'global' => array(
 30+ 'variables' => array(
 31+ 'wgWikiEditorIconVersion',
 32+ ),
 33+ ),
2934 'highlight' => array(
3035 'i18n' => 'WikiEditorHighlight',
3136 'preferences' => array(
@@ -307,17 +312,19 @@
308313
309314 // Modules
310315 $preferences = array();
311 - foreach ( $wgWikiEditorModules as $module => $enable ) {
 316+ $modules = $wgWikiEditorModules;
 317+ $modules['global'] = true;
 318+ foreach ( $modules as $module => $enable ) {
312319 if (
313320 $enable['global'] || (
314321 $enable['user']
315322 && isset( self::$modules[$module]['preferences']['enable'] )
316323 && $wgUser->getOption( self::$modules[$module]['preferences']['enable']['key'] )
317 - )
 324+ ) || $module == 'global'
318325 ) {
319326 UsabilityInitiativeHooks::initialize();
320327 // Messages
321 - if ( isset( self::$modules[$module]['i18n'], self::$modules[$module]['messages'] ) ) {
 328+ if ( isset( self::$modules[$module]['i18n'], self::$modules[$module]['messages'] ) ) {
322329 wfLoadExtensionMessages( self::$modules[$module]['i18n'] );
323330 UsabilityInitiativeHooks::addMessages( self::$modules[$module]['messages'] );
324331 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -274,7 +274,7 @@
275275 var label = $.wikiEditor.autoMsg( tool, 'label' );
276276 switch ( tool.type ) {
277277 case 'button':
278 - var src = tool.icon;
 278+ var src = tool.icon + '?' + wgWikiEditorIconVersion;
279279 if ( src.indexOf( 'http://' ) !== 0 && src.indexOf( 'https://' ) !== 0 ) {
280280 src = $.wikiEditor.imgPath + 'toolbar/' + src;
281281 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2186,7 +2186,7 @@
21872187 var label = $.wikiEditor.autoMsg( tool, 'label' );
21882188 switch ( tool.type ) {
21892189 case 'button':
2190 - var src = tool.icon;
 2190+ var src = tool.icon + '?' + wgWikiEditorIconVersion;
21912191 if ( src.indexOf( 'http://' ) !== 0 && src.indexOf( 'https://' ) !== 0 ) {
21922192 src = $.wikiEditor.imgPath + 'toolbar/' + src;
21932193 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -130,7 +130,7 @@
131131 break;case'dialog':context.$textarea.wikiEditor('openDialog',action.module);break;default:break;}},buildGroup:function(context,id,group){var $group=$('<div />').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.autoMsg(group,'label');if(label){$group.append('<div class="label">'+label+'</div>')}
132132 var empty=true;if('tools'in group){for(tool in group.tools){var tool=$.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]);if(tool){empty=false;$group.append(tool);}}}
133133 return empty?null:$group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}}
134 -var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=tool.icon;if(src.indexOf('http://')!==0&&src.indexOf('https://')!==0){src=$.wikiEditor.imgPath+'toolbar/'+src;}
 134+var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=tool.icon+'?'+wgWikiEditorIconVersion;if(src.indexOf('http://')!==0&&src.indexOf('https://')!==0){src=$.wikiEditor.imgPath+'toolbar/'+src;}
135135 $button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});}
136136 return $button;case'select':var $select=$('<div />').attr({'rel':id,'class':'tool tool-select'}).click(function(){var $options=$(this).find('.options');$options.animate({'opacity':'toggle'},'fast');});$options=$('<div />').addClass('options');if('list'in tool){for(option in tool.list){var optionLabel=$.wikiEditor.autoMsg(tool.list[option],'label');$options.append($('<a />').data('action',tool.list[option].action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));}).text(optionLabel).addClass('option').attr('rel',option));}}
137137 $select.append($('<div />').addClass('menu').append($options));$select.append($('<div />').addClass('label').text(label));return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.autoMsg(page,'label');return $('<div />').text(label).attr('rel',id).data('context',context).bind('mousedown',function(){$(this).parent().parent().find('.page').hide();$(this).parent().parent().find('.page-'+$(this).attr('rel')).show();$(this).siblings().removeClass('current');$(this).addClass('current');var section=$(this).parent().parent().attr('rel');if($.trackAction!=undefined){$.trackAction(section+'.'+$(this).attr('rel'));}

Follow-up revisions

RevisionCommit summaryAuthorDate
r59214wmf-deployment: Merge r59212catrope20:57, 18 November 2009

Status & tagging log