r101593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101592‎ | r101593 | r101594 >
Date:09:32, 2 November 2011
Author:neilk
Status:ok
Tags:
Comment:
making forms for custom and i-dont-know options. removed bindDeleter as it is no longer necessary if we do not remove an upload from a license choice
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.config.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/uploadWizard.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.config.php
@@ -224,6 +224,11 @@
225225 'type' => 'and',
226226 'licenseGroups' => array(
227227 array(
 228+ 'head' => 'mwe-upwiz-license-none-applicable-head',
 229+ 'subhead' => 'mwe-upwiz-license-none-applicable-subhead',
 230+ 'special' => 'none'
 231+ ),
 232+ array(
228233 // This should be a list of all CC licenses we can reasonably expect to find around the web
229234 'head' => 'mwe-upwiz-license-cc-head',
230235 'subhead' => 'mwe-upwiz-license-cc-subhead',
@@ -266,10 +271,11 @@
267272 )
268273 ),
269274 array(
270 - 'head' => 'mwe-upwiz-license-none-applicable-head',
271 - 'subhead' => 'mwe-upwiz-license-none-applicable-subhead',
272 - 'special' => 'delete'
273 - )
 275+ 'head' => 'mwe-upwiz-license-custom-head',
 276+ 'subhead' => 'mwe-upwiz-license-custom-subhead',
 277+ 'special' => 'custom'
 278+ ),
 279+
274280 ),
275281 'defaults' => array(),
276282 ),
@@ -277,7 +283,7 @@
278284
279285 // Default thumbnail width
280286 'thumbnailWidth' => 100,
281 -
 287+
282288 // Max thumbnail height:
283289 'thumbnailMaxHeight' => 100,
284290
Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -338,6 +338,7 @@
339339 'mwe-upwiz-license-misc',
340340 'mwe-upwiz-license-custom-head',
341341 'mwe-upwiz-license-custom-subhead',
 342+ 'mwe-upwiz-license-custom-preview',
342343 'mwe-upwiz-license-none-applicable-head',
343344 'mwe-upwiz-license-none-applicable-subhead',
344345 'mwe-upwiz-license-none-applicable',
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -261,9 +261,11 @@
262262 'mwe-upwiz-license-custom-head' => 'Experts only: enter the code for a license not shown here',
263263 'mwe-upwiz-license-custom-subhead' => 'Enter wikitext that will add a license template to your uploads.',
264264
265 - 'mwe-upwiz-license-none-applicable-head' => 'I do not know if any of the above choices apply or not! Help!',
266 - 'mwe-upwiz-license-none-applicable-subhead' => 'If you are not absolutely sure what the intentions of the original author were then please do not upload {{PLURAL:$1|this file|these files}} to this site. Press the button below to abandon {{PLURAL:$1|this upload|these uploads}} -- do not worry, nothing has been published yet.',
 265+ 'mwe-upwiz-license-none-applicable-head' => 'I don\'t know',
 266+ 'mwe-upwiz-license-none-applicable-subhead' => 'Please explain where you got the image. If it is not published under a suitable license it will be deleted without further notice.',
267267
 268+ 'mwe-upwiz-license-custom-preview' => 'Preview',
 269+
268270 'mwe-upwiz-license-none-applicable' => 'Abandon {{PLURAL:$1|this upload|these uploads}} without publishing',
269271 'mwe-upwiz-license-confirm-remove' => 'Are you sure you want to remove {{PLURAL:$1|this upload|these uploads}}?',
270272 'mwe-upwiz-license-confirm-remove-title' => 'Confirm remove',
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -394,10 +394,6 @@
395395 // set the "value" to be the null deed; which will cause an error if the data is submitted.
396396 _this.choose( mw.UploadWizardNullDeed );
397397
398 - // set the "delete associated upload" option, if available
399 - // this has a somewhat nasty & twisted dependency on the licenses config, since if you enable the 'special delete'
400 - // option there, you have to remember to pass a deleter here
401 - _this.bindDeleter();
402398 };
403399
404400
@@ -498,40 +494,6 @@
499495
500496 remove: function() {
501497 this.$selector.html('');
502 - },
503 -
504 - /**
505 - * This is a bit of a hack -- originally deeds were not supposed to know what uploads they applied to,
506 - * the associated upload would just read that data when it needed to, or rebind itself on the fly.
507 - * Unfortunately it's starting to become a bit messed up; to make deleting work, now the deeds know about the uploads,
508 - * and the uploads know about the deeds. Really ought to be that there is some channel of communication that the uploads
509 - * listen to, which could include a 'delete yourself' event.
510 - * So, what this does:
511 - * In the event that our license config includes the "special" item for i-don't-know-what-the-license-is,
512 - * this will create a button there that deletes all the associated uploads.
513 - */
514 - bindDeleter: function() {
515 - var deedChooser = this;
516 -
517 - if ( !mw.isDefined( deedChooser.deleteDialog ) ) {
518 - deedChooser.deleteDialog = mw.UploadWizardDeleteDialog(
519 - deedChooser.uploads,
520 - gM( 'mwe-upwiz-license-confirm-remove-title' ),
521 - gM( 'mwe-upwiz-license-confirm-remove', deedChooser.uploads.length )
522 - );
523 - }
524 -
525 - $j( deedChooser.$selector.find( '.mwe-upwiz-license-special-delete' ) ).each( function() {
526 - $j( this ).append(
527 - $j( '<button type="button" name="abandon"></button>' )
528 - .msg( 'mwe-upwiz-license-none-applicable', deedChooser.uploads.length )
529 - .button()
530 - .addClass( 'ui-button-text ui-button-textonly' )
531 - .click( function() {
532 - deedChooser.deleteDialog.dialog( 'open' );
533 - } )
534 - );
535 - } );
536498 }
537499
538500 }; // end UploadWizardDeed.prototype
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -7,7 +7,7 @@
88 * 'defaults' => array of template string names (can be empty array),
99 * 'licenses' => array of template string names (matching keys in mw.UploadWizard.config.licenses)
1010 * optional: 'licenseGroups' => groups of licenses, with more explanation
11 - * optional: 'special' => String -- indicates, don't put licenses here, instead leave a placeholder div, with class based on this string.
 11+ * optional: 'special' => String -- indicates, don't put licenses here, instead use a special widget
1212 * @param {Numbe} count of the things we are licensing (it matters to some texts)
1313 */
1414
@@ -121,8 +121,24 @@
122122 }
123123 var $licensesDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-deed-license' );
124124 if ( mw.isDefined( group['special'] ) ) {
125 - // put a placeholder in our interface for our caller to place some special interface in
126 - $licensesDiv.append( $j( '<div></div>' ).addClass( 'mwe-upwiz-license-special-' + group.special ) );
 125+ switch ( group['special'] ) {
 126+ case 'custom':
 127+ $licensesDiv.append(
 128+ $j( '<div></div>' ).css( { 'width': '100%' } ).append(
 129+ $j( '<div></div>' ).css( { 'float': 'right', 'width': '9em', 'padding-left': '1em' } ).append(
 130+ $j( '<span></span>' ).button( { label: gM( 'mwe-upwiz-license-custom-preview' ) } ).css( { 'width': '8em' } )
 131+ ),
 132+ $j( '<div></div>' ).css( { 'margin-right': '10em' } ).append(
 133+ $j( '<textarea></textarea>' ).growTextArea().css( { 'width': '100%' } )
 134+ ),
 135+ $j( '<div></div>' ).css( { 'clear':'both' } )
 136+ )
 137+ );
 138+ break;
 139+ case 'none':
 140+ default:
 141+ break;
 142+ }
127143 } else {
128144 appendLicenses( $licensesDiv, group );
129145 }
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css
@@ -442,7 +442,7 @@
443443 }
444444
445445 .mwe-upwiz-deed-license {
446 - margin-left: 24px;
 446+ margin-left: 1.5em;
447447 }
448448
449449 #mwe-upwiz-macro-deeds {
@@ -615,7 +615,7 @@
616616
617617 .mwe-upwiz-toggler {
618618 margin-bottom: 0;
619 - padding: 4px 0 3px 18px;
 619+ padding-left: 1.5em;
620620 /* @embed */
621621 background: url('images/toggle.png') no-repeat left center;
622622 }
@@ -626,7 +626,7 @@
627627 }
628628
629629 .mwe-upwiz-toggler-content {
630 - padding-left: 18px;
 630+ padding-left: 1.5em;
631631 }
632632
633633 .mwe-upwiz-toggled {

Status & tagging log