r73658 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73657‎ | r73658 | r73659 >
Date:14:37, 24 September 2010
Author:catrope
Status:deferred
Tags:
Comment:
1.16wmf4: Merge ArticleAssessmentPilot to trunk state
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php
@@ -14,11 +14,11 @@
1515 // Set to 'combined' or 'raw' if you need to debug this extension's JS
1616 $wgArticleAssessmentResourceMode = 'minified';
1717
18 -// Path to jQuery UI
19 -$wgArticleAssessmentJUIPath = null; // Defaults to "$wgExtensionAssetsPath/ArticleAssessmentPilot/js/jui.combined.min.js"
 18+// Path to jQuery UI's JS
 19+$wgArticleAssessmentJUIJSPath = null; // Defaults to "$wgExtensionAssetsPath/ArticleAssessmentPilot/js/jui.combined.min.js"
2020
21 -// Set to false if jQuery UI's CSS is already included through other means
22 -$wgArticleAssessmentNeedJUICSS = true;
 21+// Path to jQuery UI's CSS
 22+$wgArticleAssessmentJUICSSPath = null; // Defaults to "$wgExtensionAssetsPath/ArticleAssessmentPilot/css/jquery-ui-1.7.2.css"
2323
2424 // Auto-load files
2525 $dir = dirname( __FILE__ ) . '/';
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php
@@ -21,16 +21,16 @@
2222
2323 private static $scriptFiles = array(
2424 'raw' => array(
25 - array( 'src' => 'js/ArticleAssessment.js', 'version' => 3 ),
 25+ array( 'src' => 'js/ArticleAssessment.js', 'version' => 4 ),
2626 array( 'src' => 'js/jquery.cookie.js', 'version' => 1 ),
2727 array( 'src' => 'js/jquery.tipsy.js', 'version' => 1 ),
2828 array( 'src' => 'js/jquery.stars.js', 'version' => 1 ),
2929 ),
3030 'combined' => array(
31 - array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 2 )
 31+ array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 3 )
3232 ),
3333 'minified' => array(
34 - array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 2 )
 34+ array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 3 )
3535 ),
3636 );
3737
@@ -50,8 +50,8 @@
5151 }
5252
5353 public static function addVariables( &$vars ) {
54 - global $wgArticleAssessmentJUIPath, $wgExtensionAssetsPath;
55 - $vars['wgArticleAssessmentJUIPath'] = $wgArticleAssessmentJUIPath ? $wgArticleAssessmentJUIPath :
 54+ global $wgArticleAssessmentJUIJSPath, $wgExtensionAssetsPath;
 55+ $vars['wgArticleAssessmentJUIPath'] = $wgArticleAssessmentJUIJSPath ? $wgArticleAssessmentJUIJSPath :
5656 "$wgExtensionAssetsPath/ArticleAssessmentPilot/js/jui.combined.min.js";
5757 return true;
5858 }
@@ -101,10 +101,10 @@
102102 );
103103 }
104104
105 - global $wgArticleAssessmentNeedJUICSS;
106 - if ( $wgArticleAssessmentNeedJUICSS ) {
107 - self::$styleFiles[$mode][] = array( 'src' => 'css/jquery-ui-1.7.2.css', 'version' => '1.7.2y' );
108 - }
 105+ global $wgArticleAssessmentJUICSSPath;
 106+ $out->addExtensionStyle( ( $wgArticleAssessmentJUICSSPath ? $wgArticleAssessmentJUICSSPath :
 107+ "$wgExtensionAssetsPath/ArticleAssessmentPilot/css/jquery-ui-1.7.2.css" ) . '?1.7.2y'
 108+ );
109109 foreach ( self::$styleFiles[$mode] as $style ) {
110110 $out->addExtensionStyle( $wgExtensionAssetsPath .
111111 "/ArticleAssessmentPilot/{$style['src']}?{$style['version']}"
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js
@@ -463,9 +463,14 @@
464464 .addClass( success ? 'article-assessment-success-msg' : 'article-assessment-error-msg' )
465465 .html( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) )
466466 .appendTo( $dialogDiv );
467 - $dialogDiv
468 - .dialog( 'option', 'height', $msgDiv.height() + 100 )
469 - .removeClass( 'loading' );
 467+ $dialogDiv.removeClass( 'loading' );
 468+
 469+ // This is absurdly unnecessary from the looks of it, but it seems this is somehow
 470+ // needed in certain cases.
 471+ $.ArticleAssessment.fn.withJUI( function() {
 472+ $dialogDiv.dialog( 'option', 'height', $msgDiv.height() + 100 )
 473+ } );
 474+
470475 if ( success ) {
471476 // Hide the dialog link
472477 $( '#article-assessment .article-assessment-rate-feedback' ).hide();
Property changes on: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js
___________________________________________________________________
Added: svn:eol-style
473478 + native
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js
@@ -463,9 +463,14 @@
464464 .addClass( success ? 'article-assessment-success-msg' : 'article-assessment-error-msg' )
465465 .html( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) )
466466 .appendTo( $dialogDiv );
467 - $dialogDiv
468 - .dialog( 'option', 'height', $msgDiv.height() + 100 )
469 - .removeClass( 'loading' );
 467+ $dialogDiv.removeClass( 'loading' );
 468+
 469+ // This is absurdly unnecessary from the looks of it, but it seems this is somehow
 470+ // needed in certain cases.
 471+ $.ArticleAssessment.fn.withJUI( function() {
 472+ $dialogDiv.dialog( 'option', 'height', $msgDiv.height() + 100 )
 473+ } );
 474+
470475 if ( success ) {
471476 // Hide the dialog link
472477 $( '#article-assessment .article-assessment-rate-feedback' ).hide();
@@ -480,9 +485,10 @@
481486 .addClass( 'article-assessment-error-msg' )
482487 .html( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ) )
483488 .appendTo( $dialogDiv );
484 - $dialogDiv
485 - .dialog( 'option', 'height', $msgDiv.height() + 100 )
486 - .removeClass( 'loading' );
 489+ $dialogDiv.removeClass( 'loading' );
 490+ $.ArticleAssessment.fn.withJUI( function() {
 491+ $dialogDiv.dialog( 'option', 'height', $msgDiv.height() + 100 )
 492+ } );
487493 }
488494 } );
489495 return false;
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js
@@ -49,7 +49,7 @@
5050 $('.article-assessment-rating-field-value').each(function(){$(this).css({'width':120-(120*(parseFloat($(this).text())/5))+'px'})});},'submitRating':function(){var config=$('#article-assessment').data('articleAssessment-context').config;$.ArticleAssessment.fn.flashNotice();$('.rating-field').stars('disable');$('#article-assessment input').attr('disabled','disabled');var results={};$('.rating-field input').each(function(){var fieldName=$(this).attr('name').match(/\[([a-zA-Z0-9\-]*)\]/)[1];results[fieldName]=$(this).val();});var request=$.ajax({url:wgScriptPath+'/api.php',type:'POST',data:{'action':'articleassessment','revid':config.revID,'pageid':config.pageID,'r1':results['wellsourced'],'r2':results['neutrality'],'r3':results['completeness'],'r4':results['readability'],'anontoken':config.userID,'format':'json'},dataType:'json',success:$.ArticleAssessment.fn.afterSubmitRating,error:function(XMLHttpRequest,textStatus,errorThrown){$.ArticleAssessment.fn.flashNotice($.ArticleAssessment.fn.getMsg('articleassessment-error'),{'class':'article-assessment-error-msg'});}});},'afterSubmitRating':function(data){$.ArticleAssessment.fn.getRatingData();$('.ui-stars-star-on').addClass('ui-stars-star-rated');$('.rating-field').stars('enable');$('#article-assessment input:disabled').removeAttr('disabled');$.ArticleAssessment.fn.showRatings();$.ArticleAssessment.fn.flashNotice($.ArticleAssessment.fn.getMsg('articleassessment-thanks'),{'class':'article-assessment-success-msg'});},'flashNotice':function(text,options){if(arguments.length==0){$('#article-assessment .article-assessment-flash').remove();}else{$('#article-assessment .article-assessment-flash').remove();var className=options['class'];$msg=$('<div />').addClass('article-assessment-flash').html(text);if(options['class']){$msg.addClass(options['class']);}
5151 $('#article-assessment .article-assessment-submit').append($msg);}},'showFeedback':function(){$.ArticleAssessment.fn.withJUI(function(){var $dialogDiv=$('#article-assessment-dialog');if($dialogDiv.size()==0){$dialogDiv=$('<div id="article-assessment-dialog" class="loading" />').dialog({width:600,height:400,bgiframe:true,autoOpen:true,modal:true,title:$.ArticleAssessment.fn.getMsg('articleassessment-survey-title'),close:function(){$(this).dialog('option','height',400).find('.article-assessment-success-msg, .article-assessment-error-msg').remove().end().find('form').show();}});$dialogDiv.load(wgScript+'?title=Special:SimpleSurvey&survey=articlerating&raw=1',function(){$(this).find('form').bind('submit',$.ArticleAssessment.fn.submitFeedback);$(this).removeClass('loading');});}
5252 $dialogDiv.dialog('open');});return false;},'submitFeedback':function(){var $dialogDiv=$('#article-assessment-dialog');$dialogDiv.find('form').hide().end().addClass('loading');var formData={};$dialogDiv.find('input').each(function(){var name=$(this).attr('name');if(name!==''){if(name.substr(-2)=='[]'){var trimmedName=name.substr(0,name.length-2);if(typeof formData[trimmedName]=='undefined'){formData[trimmedName]=[];}
53 -formData[trimmedName].push($(this).val());}else{formData[name]=$(this).val();}}});formData.title='Special:SimpleSurvey';$.ajax({url:wgScript,type:'POST',data:formData,dataType:'html',success:function(data){var success=$(data).find('.simplesurvey-success').size()>0;var $msgDiv=$('<div />').addClass(success?'article-assessment-success-msg':'article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg(success?'articleassessment-survey-thanks':'articleassessment-error')).appendTo($dialogDiv);$dialogDiv.dialog('option','height',$msgDiv.height()+100).removeClass('loading');if(success){$('#article-assessment .article-assessment-rate-feedback').hide();$.cookie('mwArticleAssessmentHideFeedback',true,{'expires':30,'path':'/'});}},error:function(XMLHttpRequest,textStatus,errorThrown){var $msgDiv=$('<div />').addClass('article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg('articleassessment-error')).appendTo($dialogDiv);$dialogDiv.dialog('option','height',$msgDiv.height()+100).removeClass('loading');}});return false;},'addMessages':function(messages){for(var key in messages){$.ArticleAssessment.messages[key]=messages[key];}},'getMsg':function(key,args){if(!(key in $.ArticleAssessment.messages)){return'['+key+']';}
 53+formData[trimmedName].push($(this).val());}else{formData[name]=$(this).val();}}});formData.title='Special:SimpleSurvey';$.ajax({url:wgScript,type:'POST',data:formData,dataType:'html',success:function(data){var success=$(data).find('.simplesurvey-success').size()>0;var $msgDiv=$('<div />').addClass(success?'article-assessment-success-msg':'article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg(success?'articleassessment-survey-thanks':'articleassessment-error')).appendTo($dialogDiv);$dialogDiv.removeClass('loading');$.ArticleAssessment.fn.withJUI(function(){$dialogDiv.dialog('option','height',$msgDiv.height()+100)});if(success){$('#article-assessment .article-assessment-rate-feedback').hide();$.cookie('mwArticleAssessmentHideFeedback',true,{'expires':30,'path':'/'});}},error:function(XMLHttpRequest,textStatus,errorThrown){var $msgDiv=$('<div />').addClass('article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg('articleassessment-error')).appendTo($dialogDiv);$dialogDiv.dialog('option','height',$msgDiv.height()+100).removeClass('loading');}});return false;},'addMessages':function(messages){for(var key in messages){$.ArticleAssessment.messages[key]=messages[key];}},'getMsg':function(key,args){if(!(key in $.ArticleAssessment.messages)){return'['+key+']';}
5454 var msg=$.ArticleAssessment.messages[key];if(typeof args=='object'||typeof args=='array'){for(var i=0;i<args.length;i++){msg=msg.replace(new RegExp('\\$'+(parseInt(i)+1),'g'),args[i]);}}else if(typeof args=='string'||typeof args=='number'){msg=msg.replace(/\$1/g,args);}
5555 return msg;},'withJUI':function(callback){if(typeof $.ui=='undefined'){$.getScript(wgArticleAssessmentJUIPath,callback);}else{callback();}}}};$(document).ready(function(){$.ArticleAssessment.fn.init();});})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
5656 var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
Property changes on: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js
___________________________________________________________________
Added: svn:eol-style
5757 + native
Property changes on: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot
___________________________________________________________________
Added: svn:mergeinfo
5858 Merged /trunk/extensions/ArticleAssessmentPilot:r73554-73657
5959 Merged /trunk/phase3/extensions/ArticleAssessmentPilot:r63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816
6060 Merged /branches/wmf-deployment/extensions/ArticleAssessmentPilot:r60970

Status & tagging log