r86687 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86686‎ | r86687 | r86688 >
Date:00:58, 22 April 2011
Author:neilk
Status:ok (Comments)
Tags:
Comment:
confirm dialogs for upload deletion
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -302,6 +302,8 @@
303303 'mwe-upwiz-license-none-applicable-head',
304304 'mwe-upwiz-license-none-applicable-subhead',
305305 'mwe-upwiz-license-none-applicable',
 306+ 'mwe-upwiz-license-confirm-remove',
 307+ 'mwe-upwiz-license-confirm-remove-title',
306308 'mwe-upwiz-categories',
307309 'mwe-upwiz-categories-add',
308310 'mwe-upwiz-category-remove',
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -251,6 +251,8 @@
252252 '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.',
253253
254254 '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',
255257
256258
257259 'mwe-upwiz-categories' => 'Categories',
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -460,21 +460,29 @@
461461 */
462462 bindDeleter: function() {
463463 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+
464473 $j( deedChooser.$selector.find( '.mwe-upwiz-license-special-delete' ) ).each( function() {
465474 $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+ } )
476483 );
477484 } );
478485 }
479 -};
480486
 487+}; // end UploadWizardDeed.prototype
 488+
481489 } )( jQuery );
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js
@@ -221,7 +221,7 @@
222222 _this.updateFilename();
223223 } else {
224224 var errorMessage = hasExtension ? 'mwe-upwiz-upload-error-bad-filename-extension' : 'mwe-upwiz-upload-error-bad-filename-no-extension';
225 - $( '<div>' )
 225+ $( '<div></div>' )
226226 .append(
227227 $j( '<p>' ).msg( errorMessage, extension ),
228228 $j( '<p>' ).msg( 'mwe-upwiz-allowed-filename-extensions' ),
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -1293,7 +1293,48 @@
12941294
12951295 };
12961296
 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+};
12971337
 1338+
12981339 mw.UploadWizardDeedPreview = function(upload) {
12991340 this.upload = upload;
13001341 };

Follow-up revisions

RevisionCommit summaryAuthorDate
r86717adding documentationneilk17:19, 22 April 2011
r86843UploadWizard: Remove debugger; statement introduced in r86687catrope11:12, 25 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:45, 22 April 2011

"Confirm remove" could use message documentation because of the ambiguity between title or action.

#Comment by NeilK (talk | contribs)   17:19, 22 April 2011

added documentation in r86717

Status & tagging log