r78573 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78572‎ | r78573 | r78574 >
Date:19:08, 18 December 2010
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Follow up to r78569
Modified paths:
  • /trunk/extensions/Push/Push.i18n.php (modified) (history)
  • /trunk/extensions/Push/Push.php (modified) (history)
  • /trunk/extensions/Push/includes/Push_Tab.php (modified) (history)
  • /trunk/extensions/Push/includes/ext.push.tab.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Push/Push.i18n.php
@@ -56,7 +56,8 @@
5757 'push-tab-err-filepush' => 'File push failed: $1',
5858 'push-tab-embedded-files' => '(Embedded files: $1)', // JS message, if you want to add plural, then fix the JS first.
5959 'push-tab-no-embedded-files' => '(No files are embedded in this page.)',
60 - 'push-tab-included-override' => 'One or more included templates or files will be overriden.',
 60+ 'push-tab-files-override' => 'These files already exist: $1', // JS message, if you want to add plural, then fix the JS first.
 61+ 'push-tab-template-override' => 'These templates already exist: $1', // JS message, if you want to add plural, then fix the JS first.
6162
6263 // Special page
6364 'special-push' => 'Push pages',
Index: trunk/extensions/Push/Push.php
@@ -92,7 +92,8 @@
9393 'push-tab-err-filepush-unknown',
9494 'push-tab-embedded-files',
9595 'push-tab-no-embedded-files',
96 - 'push-tab-included-override'
 96+ 'push-tab-files-override',
 97+ 'push-tab-template-override',
9798 );
9899
99100 // For backward compatibility with MW < 1.17.
Index: trunk/extensions/Push/includes/Push_Tab.php
@@ -248,13 +248,20 @@
249249 Html::element(
250250 'div',
251251 array(
252 - 'id' => 'targetconflicts' . $targetId,
 252+ 'id' => 'targettemplateconflicts' . $targetId,
253253 'style' => 'display:none; color:darkgray'
254254 )
255 - ) .
 255+ ) .
256256 Html::element(
257257 'div',
258258 array(
 259+ 'id' => 'targetfileconflicts' . $targetId,
 260+ 'style' => 'display:none; color:darkgray'
 261+ )
 262+ ) .
 263+ Html::element(
 264+ 'div',
 265+ array(
259266 'id' => 'targeterrors' . $targetId,
260267 'style' => 'display:none; color:darkred'
261268 )
Index: trunk/extensions/Push/includes/ext.push.tab.js
@@ -140,6 +140,7 @@
141141 .join( '|' ),
142142 },
143143 function( data ) {
 144+ alert(data);
144145 if ( data.query ) {
145146 var infoDiv = $( '#targetinfo' + targetId );
146147
@@ -193,31 +194,50 @@
194195 }
195196
196197 function displayTargetConflictStatus( targetId ) {
197 - var nsToCheck = [];
 198+ if ( !targetData[targetId] ) {
 199+ // It's possible the request to retrieve this data failed, so don't do anything when this is the case.
 200+ return;
 201+ }
198202
199203 if ( $('#checkIncTemplates').attr('checked') ) {
200 - nsToCheck.push( 10 );
 204+ var overideTemplates = [];
 205+
 206+ for ( remotePageId in targetData[targetId].existingPages ) {
 207+ if ( targetData[targetId].existingPages[remotePageId].ns == 10 ) {
 208+ // Add the template, but get rid of the namespace prefix first.
 209+ overideTemplates.push( targetData[targetId].existingPages[remotePageId].title.split( ':', 2 )[1] );
 210+ }
 211+ }
 212+
 213+ if ( overideTemplates.length > 0 ) {
 214+ $( '#targettemplateconflicts' + targetId )
 215+ .text( mediaWiki.msg( 'push-tab-template-override', overideTemplates.join( ', ' ) ) )
 216+ .fadeIn( 'slow' );
 217+ }
 218+ else {
 219+ $( '#targettemplateconflicts' + targetId ).fadeOut( 'slow' );
 220+ }
201221 }
202222
203223 if ( $('#checkIncFiles').length != 0 && $('#checkIncFiles').attr('checked') ) {
204 - nsToCheck.push( 6 );
205 - }
206 -
207 - var hasConflict = false;
208 -
209 - for ( remotePageId in targetData[targetId].existingPages ) {
210 - if ( $.inArray( targetData[targetId].existingPages[remotePageId].ns, nsToCheck ) ) {
211 - hasConflict = true;
212 - break;
 224+ var overideFiles = [];
 225+
 226+ for ( remotePageId in targetData[targetId].existingPages ) {
 227+ if ( targetData[targetId].existingPages[remotePageId].ns == 6 ) {
 228+ // Add the file, but get rid of the namespace prefix first.
 229+ overideFiles.push( targetData[targetId].existingPages[remotePageId].title.split( ':', 2 )[1] );
 230+ }
213231 }
 232+
 233+ if ( overideFiles.length > 0 ) {
 234+ $( '#targetfileconflicts' + targetId )
 235+ .text( mediaWiki.msg( 'push-tab-files-override', overideFiles.join( ', ' ) ) )
 236+ .fadeIn( 'slow' );
 237+ }
 238+ else {
 239+ $( '#targetfileconflicts' + targetId ).fadeOut( 'slow' );
 240+ }
214241 }
215 -
216 - if ( hasConflict ) {
217 - $( '#targetconflicts' + targetId ).text( mediaWiki.msg( 'push-tab-included-override' ) ).fadeIn( 'slow' );
218 - }
219 - else {
220 - $( '#targetconflicts' + targetId ).fadeOut( 'slow' );
221 - }
222242 }
223243
224244 function initiatePush( sender, pages, targetUrl, targetName ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r78575Follow up to r78573jeroendedauw19:11, 18 December 2010
r78577Follow up to r78573jeroendedauw19:45, 18 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78569Follow up to r78568jeroendedauw16:54, 18 December 2010

Comments

#Comment by Raymond (talk | contribs)   19:24, 18 December 2010

The comments like in

+	'push-tab-files-override' => 'These files already exist: $1', // JS message, if you want to add plural, then fix the JS first.
+	'push-tab-template-override' => 'These templates already exist: $1', // JS message, if you want to add plural, then fix the JS first.

will be deleted by the export sript of Translatewiki. It would be more helpful if you add some hints (like "JavaScript message, no PLURAL available") for our translators in the qqq section. Thanks.

#Comment by Jeroen De Dauw (talk | contribs)   19:45, 18 December 2010

Sure. Fixed in r78577

Status & tagging log