r84732 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84731‎ | r84732 | r84733 >
Date:07:20, 25 March 2011
Author:neilk
Status:deferred
Tags:
Comment:
fixing bug #24696, radio buttons for license options
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -1,5 +1,5 @@
22 /**
3 - * Create a group of checkboxes for licenses. N.b. the licenses are named after the templates they invoke.
 3+ * Create a group of radio buttons for licenses. N.b. the licenses are named after the templates they invoke.
44 * @param div
55 * @param values (optional) array of license key names to activate by default
66 */
@@ -17,16 +17,16 @@
1818 _this.$selector = $j( selector );
1919 _this.$selector.append( $j( '<div class="mwe-error"></div>' ) );
2020
 21+ var name = 'license' + widgetCount;
 22+
2123 $j.each( mw.UploadWizard.config[ 'licenses' ], function( i, licenseConfig ) {
2224 var template = licenseConfig.template;
2325 var messageKey = licenseConfig.messageKey;
24 -
25 - var name = 'license_' + template;
26 - var id = 'licenseInput' + widgetCount + '_' + name;
27 - var $input = $j( '<input />' )
28 - .attr( { id: id, name: name, type: 'checkbox', value: template } )
29 - // we use the selector because events can't be unbound unless they're in the DOM.
30 - .click( function() { _this.$selector.trigger( 'changeLicenses' ); } );
 26+
 27+ var id = name + template;
 28+ // IE6 is idiotic about radio buttons; you have to create them as HTML or clicks aren't recorded
 29+ var $input = $j( '<input id="' + id + '" name="' + name + '" type="radio" value="' + template + '"/>' );
 30+ $input.click( function() { _this.$selector.trigger( 'changeLicenses' ); } );
3131 _this.inputs.push( $input );
3232 _this.$selector.append(
3333 $input,

Status & tagging log