r86585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86584‎ | r86585 | r86586 >
Date:00:16, 21 April 2011
Author:kaldari
Status:ok
Tags:
Comment:
fixing bug 28477 - allow dates to be manually entered, also some formatting tweaks
Modified paths:
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/uploadWizard.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css
@@ -41,6 +41,10 @@
4242 display: inline-block;
4343 }
4444
 45+.cat-widget .categoryInput {
 46+ width: 16em;
 47+}
 48+
4549 /* Fix for IE6 */
4650 .cat-widget .ui-button {
4751 position: static;
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css
@@ -660,8 +660,8 @@
661661 padding: 0.25em;
662662 }
663663
664 -.mwe-date-display {
665 - width: 100%;
 664+.mwe-date {
 665+ width: 20em;
666666 background: #ffffff url('images/calendar.gif') no-repeat right center;
667667 }
668668
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -128,7 +128,6 @@
129129 );
130130
131131 var dateInputId = "dateInput" + ( _this.upload.index ).toString();
132 - var dateDisplayInputId = "dateDisplayInput" + ( _this.upload.index ).toString();
133132
134133 var dateErrorDiv = $j('<div class="mwe-upwiz-details-input-error"><label class="mwe-validator-error" for="' + dateInputId + '" generated="true"/></div>');
135134
@@ -137,14 +136,12 @@
138137 /* $.datepicker.setDefaults() for other settings */
139138 _this.dateInput =
140139 $j( '<input type="text" id="' + dateInputId + '" name="' + dateInputId + '" type="text" class="mwe-date" size="20"/>' );
141 - _this.dateDisplayInput =
142 - $j( '<input type="text" id="' + dateDisplayInputId + '" name="' + dateDisplayInputId + '" type="text" class="mwe-date-display" size="20"/>' );
143140
144141 var dateInputDiv = $j( '<div class="mwe-upwiz-details-fieldname-input ui-helper-clearfix"></div>' )
145142 .append(
146143 dateErrorDiv,
147 - $j( '<div class="mwe-upwiz-details-fieldname"></div>' ).append( gM( 'mwe-upwiz-date-created' ) ),
148 - $j( '<div class="mwe-upwiz-details-input"></div>' ).append( _this.dateInput, _this.dateDisplayInput ) );
 144+ $j( '<div class="mwe-upwiz-details-fieldname"></div>' ).append( gM( 'mwe-upwiz-date-created' ) ).requiredFieldLabel(),
 145+ $j( '<div class="mwe-upwiz-details-input"></div>' ).append( _this.dateInput ) );
149146
150147 var moreDetailsCtrlDiv = $j( '<div class="mwe-upwiz-details-more-options"></div>' );
151148
@@ -188,37 +185,29 @@
189186
190187 _this.$form.validate();
191188 _this.$form.find( '.mwe-date' ).rules( "add", {
192 - dateISO: true,
 189+ required: true,
 190+ /* dateISO: true, */
193191 messages: {
194 - dateISO: gM( 'mwe-upwiz-error-date' )
 192+ required: gM( 'mwe-upwiz-error-blank' )
 193+ /* dateISO: gM( 'mwe-upwiz-error-date' ) */
195194 }
196195 } );
197196
198 - // we hide the "real" ISO date, and create another "display" date
199 - _this.$form.find( '.mwe-date-display' )
200 - .datepicker( {
201 - dateFormat: 'DD, MM d, yy',
 197+ _this.$form.find( '.mwe-date' )
 198+ .datepicker( {
 199+ dateFormat: 'yy-mm-dd',
 200+ constrainInput: false,
202201 //buttonImage: mw.getMwEmbedPath() + 'skins/common/images/calendar.gif',
203202 showOn: 'focus',
204203 /* buttonImage: '???',
205204 buttonImageOnly: true, */
206 - changeMonth: true,
207 - changeYear: true,
 205+ changeMonth: true,
 206+ changeYear: true,
208207 showAnim: 'slideDown',
209 - altField: '#' + dateInputId,
210 - altFormat: 'yy-mm-dd',
211 - minDate: new Date( 1800, 0, 1 )
 208+ showButtonPanel: true
212209 } )
213 - .click( function() { $j( this ).datepicker( 'show' ); } )
214 - .readonly();
 210+ .click( function() { $j( this ).datepicker( 'show' ); } );
215211
216 - _this.$form.find( '.mwe-date' )
217 - .bind( 'change', function() { $j( this ).valid(); } )
218 - .hide();
219 -
220 - /* if the date is not valid, we need to pop open the "more options". How?
221 - guess we'll revalidate it with element */
222 -
223212 mw.UploadWizardUtil.makeToggler( moreDetailsCtrlDiv, moreDetailsDiv );
224213
225214 _this.addDescription( true, mw.config.get( 'wgUserLanguage' ) );
@@ -469,7 +458,6 @@
470459
471460 // ok by now we should definitely have a dateObj and a date string
472461 $j( _this.dateInput ).val( dateStr );
473 - $j( _this.dateDisplayInput ).datepicker( "setDate", dateObj );
474462 },
475463
476464 /**
@@ -619,7 +607,6 @@
620608 information['description'] += desc.getWikiText();
621609 } );
622610
623 - // XXX add a sanity check here for good date
624611 information['date'] = $j.trim( $j( _this.dateInput ).val() );
625612
626613 var deed = _this.upload.deedChooser.deed;

Status & tagging log