Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -302,6 +302,8 @@ |
303 | 303 | 'mwe-upwiz-license-none-applicable-head', |
304 | 304 | 'mwe-upwiz-license-none-applicable-subhead', |
305 | 305 | 'mwe-upwiz-license-none-applicable', |
| 306 | + 'mwe-upwiz-license-confirm-remove', |
| 307 | + 'mwe-upwiz-license-confirm-remove-title', |
306 | 308 | 'mwe-upwiz-categories', |
307 | 309 | 'mwe-upwiz-categories-add', |
308 | 310 | 'mwe-upwiz-category-remove', |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -251,6 +251,8 @@ |
252 | 252 | 'mwe-upwiz-license-none-applicable-subhead' => 'If you aren\'t absolutely sure what the intentions of the original author were then please do not upload {{PLURAL:$1|this file|these files}} to {{SITENAME}}. Press the button below to abandon {{PLURAL:$1|this upload|these uploads}} -- don\'t worry, nothing\'s been published yet.', |
253 | 253 | |
254 | 254 | 'mwe-upwiz-license-none-applicable' => 'Abandon {{PLURAL:$1|this upload|these uploads}} without publishing', |
| 255 | + 'mwe-upwiz-license-confirm-remove' => 'Are you sure you want to remove {{PLURAL:$1|this upload|these uploads}}?', |
| 256 | + 'mwe-upwiz-license-confirm-remove-title' => 'Confirm remove', |
255 | 257 | |
256 | 258 | |
257 | 259 | 'mwe-upwiz-categories' => 'Categories', |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js |
— | — | @@ -460,21 +460,29 @@ |
461 | 461 | */ |
462 | 462 | bindDeleter: function() { |
463 | 463 | var deedChooser = this; |
| 464 | + |
| 465 | + if ( !mw.isDefined( deedChooser.deleteDialog ) ) { |
| 466 | + deedChooser.deleteDialog = mw.UploadWizardDeleteDialog( |
| 467 | + deedChooser.uploads, |
| 468 | + gM( 'mwe-upwiz-license-confirm-remove-title' ), |
| 469 | + gM( 'mwe-upwiz-license-confirm-remove', deedChooser.uploads.length ) |
| 470 | + ); |
| 471 | + } |
| 472 | + |
464 | 473 | $j( deedChooser.$selector.find( '.mwe-upwiz-license-special-delete' ) ).each( function() { |
465 | 474 | $j( this ).append( |
466 | | - $j( '<button></button>' ) |
467 | | - .attr( 'type', 'button' ) |
468 | | - .msg( 'mwe-upwiz-license-none-applicable', deedChooser.uploads.length ) |
469 | | - .button() |
470 | | - .addClass( 'ui-button-text ui-button-textonly' ) |
471 | | - .click( function() { |
472 | | - $j.each( deedChooser.uploads, function( i, upload ) { |
473 | | - upload.remove(); |
474 | | - } ); |
475 | | - } ) |
| 475 | + $j( '<button></button>' ) |
| 476 | + .attr( 'type', 'button' ) |
| 477 | + .msg( 'mwe-upwiz-license-none-applicable', deedChooser.uploads.length ) |
| 478 | + .button() |
| 479 | + .addClass( 'ui-button-text ui-button-textonly' ) |
| 480 | + .click( function() { |
| 481 | + deedChooser.deleteDialog.dialog( 'open' ); |
| 482 | + } ) |
476 | 483 | ); |
477 | 484 | } ); |
478 | 485 | } |
479 | | -}; |
480 | 486 | |
| 487 | +}; // end UploadWizardDeed.prototype |
| 488 | + |
481 | 489 | } )( jQuery ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js |
— | — | @@ -221,7 +221,7 @@ |
222 | 222 | _this.updateFilename(); |
223 | 223 | } else { |
224 | 224 | var errorMessage = hasExtension ? 'mwe-upwiz-upload-error-bad-filename-extension' : 'mwe-upwiz-upload-error-bad-filename-no-extension'; |
225 | | - $( '<div>' ) |
| 225 | + $( '<div></div>' ) |
226 | 226 | .append( |
227 | 227 | $j( '<p>' ).msg( errorMessage, extension ), |
228 | 228 | $j( '<p>' ).msg( 'mwe-upwiz-allowed-filename-extensions' ), |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -1293,7 +1293,48 @@ |
1294 | 1294 | |
1295 | 1295 | }; |
1296 | 1296 | |
| 1297 | +/** |
| 1298 | + * Makes a modal dialog to confirm deletion of one or more uploads. Will have "Remove" and "Cancel" buttons |
| 1299 | + * @param {Array} array of UploadWizardUpload objects |
| 1300 | + * @param {String} message for dialog title |
| 1301 | + * @param {String} message for dialog text, which will precede an unordered list of upload titles. |
| 1302 | + */ |
| 1303 | +mw.UploadWizardDeleteDialog = function( uploads, dialogTitle, dialogText ) { |
| 1304 | + var $filenameList = $j( '<ul></ul>' ); |
| 1305 | + $j.each( uploads, function( i, upload ) { |
| 1306 | + $filenameList.append( $j( '<li></li>' ).append( upload.title.getMain() ) ); |
| 1307 | + } ); |
| 1308 | + var buttons = [ |
| 1309 | + { |
| 1310 | + text: gM( 'mwe-upwiz-remove', uploads.length ), |
| 1311 | + click: function() { |
| 1312 | + $j.each( uploads, function( i, upload ) { |
| 1313 | + upload.remove(); |
| 1314 | + } ); |
| 1315 | + $j( this ).dialog( 'close' ); |
| 1316 | + } |
| 1317 | + }, |
| 1318 | + { |
| 1319 | + text: gM( 'mwe-upwiz-cancel', uploads.length ), |
| 1320 | + click: function() { |
| 1321 | + debugger; |
| 1322 | + $j( this ).dialog( 'close' ) |
| 1323 | + } |
| 1324 | + } |
| 1325 | + ]; |
| 1326 | + return $j( '<div></div>' ) |
| 1327 | + .append( $j( '<p></p>' ).append( dialogText ), $filenameList ) |
| 1328 | + .dialog( { |
| 1329 | + width: 500, |
| 1330 | + zIndex: 200000, |
| 1331 | + autoOpen: false, |
| 1332 | + title: dialogTitle, |
| 1333 | + modal: true, |
| 1334 | + buttons: buttons |
| 1335 | + } ); |
| 1336 | +}; |
1297 | 1337 | |
| 1338 | + |
1298 | 1339 | mw.UploadWizardDeedPreview = function(upload) { |
1299 | 1340 | this.upload = upload; |
1300 | 1341 | }; |