Index: trunk/extensions/Push/Push.i18n.php |
— | — | @@ -56,7 +56,8 @@ |
57 | 57 | 'push-tab-err-filepush' => 'File push failed: $1', |
58 | 58 | 'push-tab-embedded-files' => '(Embedded files: $1)', // JS message, if you want to add plural, then fix the JS first. |
59 | 59 | '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. |
61 | 62 | |
62 | 63 | // Special page |
63 | 64 | 'special-push' => 'Push pages', |
Index: trunk/extensions/Push/Push.php |
— | — | @@ -92,7 +92,8 @@ |
93 | 93 | 'push-tab-err-filepush-unknown', |
94 | 94 | 'push-tab-embedded-files', |
95 | 95 | 'push-tab-no-embedded-files', |
96 | | - 'push-tab-included-override' |
| 96 | + 'push-tab-files-override', |
| 97 | + 'push-tab-template-override', |
97 | 98 | ); |
98 | 99 | |
99 | 100 | // For backward compatibility with MW < 1.17. |
Index: trunk/extensions/Push/includes/Push_Tab.php |
— | — | @@ -248,13 +248,20 @@ |
249 | 249 | Html::element( |
250 | 250 | 'div', |
251 | 251 | array( |
252 | | - 'id' => 'targetconflicts' . $targetId, |
| 252 | + 'id' => 'targettemplateconflicts' . $targetId, |
253 | 253 | 'style' => 'display:none; color:darkgray' |
254 | 254 | ) |
255 | | - ) . |
| 255 | + ) . |
256 | 256 | Html::element( |
257 | 257 | 'div', |
258 | 258 | array( |
| 259 | + 'id' => 'targetfileconflicts' . $targetId, |
| 260 | + 'style' => 'display:none; color:darkgray' |
| 261 | + ) |
| 262 | + ) . |
| 263 | + Html::element( |
| 264 | + 'div', |
| 265 | + array( |
259 | 266 | 'id' => 'targeterrors' . $targetId, |
260 | 267 | 'style' => 'display:none; color:darkred' |
261 | 268 | ) |
Index: trunk/extensions/Push/includes/ext.push.tab.js |
— | — | @@ -140,6 +140,7 @@ |
141 | 141 | .join( '|' ), |
142 | 142 | }, |
143 | 143 | function( data ) { |
| 144 | + alert(data); |
144 | 145 | if ( data.query ) { |
145 | 146 | var infoDiv = $( '#targetinfo' + targetId ); |
146 | 147 | |
— | — | @@ -193,31 +194,50 @@ |
194 | 195 | } |
195 | 196 | |
196 | 197 | 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 | + } |
198 | 202 | |
199 | 203 | 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 | + } |
201 | 221 | } |
202 | 222 | |
203 | 223 | 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 | + } |
213 | 231 | } |
| 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 | + } |
214 | 241 | } |
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 | | - } |
222 | 242 | } |
223 | 243 | |
224 | 244 | function initiatePush( sender, pages, targetUrl, targetName ) { |