r65919 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65918‎ | r65919 | r65920 >
Date:20:36, 4 May 2010
Author:neilk
Status:deferred
Tags:
Comment:
File: links use NS_FILE, added buttons to step 4
Modified paths:
  • /branches/js2-work/phase3/includes/specials/SpecialUploadWizard.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js (modified) (history)
  • /branches/js2-work/phase3/js/specialUploadWizardPage.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/includes/specials/SpecialUploadWizard.php
@@ -99,6 +99,7 @@
100100 global $wgUser, $wgOut;
101101 global $wgUseAjax, $wgAjaxLicensePreview, $wgEnableAPI;
102102 global $wgEnableFirefogg, $wgFileExtensions;
 103+ global $wgCanonicalNamespaceNames;
103104
104105 $wgOut->addScript( Skin::makeVariablesScript( array(
105106 // uncertain if this is relevant. Can we do license preview with API?
@@ -110,8 +111,10 @@
111112 'wgFileExtensions' => $wgFileExtensions,
112113
113114 // our edit token
114 - 'wgEditToken' => $wgUser->editToken()
 115+ 'wgEditToken' => $wgUser->editToken(),
115116
 117+ 'wgCanonicalNamespaceNames' => $wgCanonicalNamespaceNames
 118+
116119 // in the future, we ought to be telling JS land other things,
117120 // like: requirements for publication, acceptable licenses, etc.
118121
Index: branches/js2-work/phase3/js/mwEmbed/loader.js
@@ -152,6 +152,7 @@
153153 "$j.fn.suggestions" : "jquery/plugins/jquery.suggestions.js",
154154 "$j.fn.textSelection" : "jquery/plugins/jquery.textSelection.js",
155155 "$j.browserTest" : "jquery/plugins/jquery.browserTest.js",
 156+ "$j.fn.jWizard" : "jquery/plugins/jquery.jWizard.js",
156157
157158 "$j.effects.blind" : "jquery/jquery.ui/ui/effects.blind.js",
158159 "$j.effects.drop" : "jquery/jquery.ui/ui/effects.drop.js",
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js
@@ -81,7 +81,7 @@
8282 "mwe-copyright-custom": "Custom",
8383
8484 "mwe-upwiz-next": "Next",
85 - "mwe-upwiz-home": "Wikimedia Commons",
 85+ "mwe-upwiz-home": "Go to Wiki home page",
8686 "mwe-upwiz-upload-another": "Upload more files",
8787
8888 "mwe-prevent-close": "Your files are still uploading. Are you sure you want to navigate away from this page?",
@@ -474,7 +474,7 @@
475475 var _this = this;
476476
477477 _this.filename = result.upload.filename;
478 - _this.title = "File:" + _this.filename;
 478+ _this.title = mw.getConfig( 'fileNamespace' ) + ':' + _this.filename;
479479
480480 _this.extractImageInfo( result.upload.imageinfo );
481481
@@ -1160,8 +1160,7 @@
11611161 */
11621162 setFilenameFromTitle: function() {
11631163 var _this = this;
1164 - // "File:" is the constant NS_FILE, defined in Namespaces.php. Usually unchangeable?
1165 - _this.filename = "File:" + _this.getFilenameFromTitle();
 1164+ _this.filename = mw.getConfig( 'fileNamespace' ) + ':' + _this.getFilenameFromTitle();
11661165 $j( '#mwe-upwiz-details-filename' ).text( _this.filename );
11671166
11681167 },
@@ -1815,6 +1814,15 @@
18161815 return null;
18171816 },
18181817 */
 1818+
 1819+ reset: function() {
 1820+ var _this = this;
 1821+ $j.each( _this.uploads, function( i, upload ) {
 1822+ _this.removeUpload( upload );
 1823+ } );
 1824+ _this.uploads = [];
 1825+ },
 1826+
18191827
18201828 /**
18211829 * create the basic interface to make an upload in this div
@@ -1881,8 +1889,8 @@
18821890 + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-thanks">'
18831891 + '<div id="mwe-upwiz-thanks"></div>'
18841892 + '<div class="mwe-upwiz-buttons"/>'
1885 - + '<button class="mwe-upwiz-button-begin" />'
1886 - + '<br/><button class="mwe-upwiz-button-home" />'
 1893+ + '<button class="mwe-upwiz-button-begin"></button>'
 1894+ + '<br/><button class="mwe-upwiz-button-home"></button>'
18871895 + '</div>'
18881896 + '</div>'
18891897
@@ -1891,9 +1899,14 @@
18921900 + '<div class="mwe-upwiz-clearing"></div>';
18931901
18941902
1895 - $j( '.mwe-upwiz-button-home' ).append( gM( 'mwe-upwiz-home' ) );
1896 - $j( '.mwe-upwiz-button-begin' ).append( gM( 'mwe-upwiz-upload-another' ) );
 1903+ $j( '.mwe-upwiz-button-home' )
 1904+ .append( gM( 'mwe-upwiz-home' ) )
 1905+ .click( function() { window.location.href = '/' } );
18971906
 1907+ $j( '.mwe-upwiz-button-begin' )
 1908+ .append( gM( 'mwe-upwiz-upload-another' ) )
 1909+ .click( _this.reset() );
 1910+
18981911 $j( '.mwe-upwiz-button-next' )
18991912 .append( gM( 'mwe-upwiz-next' ) )
19001913
@@ -2121,6 +2134,9 @@
21222135 if ( upload.deedChooser ) {
21232136 upload.deedChooser.detach( upload );
21242137 }
 2138+ upload.details.div.remove();
 2139+ upload.thanksDiv.remove();
 2140+
21252141 mw.UploadWizardUtil.removeItem( _this.uploads, upload );
21262142 _this.updateFileCounts();
21272143 },
@@ -2345,13 +2361,14 @@
23462362
23472363 $j.each( _this.uploads, function(i, upload) {
23482364 var thanksDiv = $j( '<div class="mwe-upwiz-thanks ui-helper-clearfix" />' );
 2365+ _this.thanksDiv = thanksDiv;
23492366
23502367 var thumbnailDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-thumbnail' );
23512368 thanksDiv.append( thumbnailDiv );
23522369 upload.setThumbnail( thumbnailDiv );
23532370
2354 - var thumbTitle = upload.title.replace(/^File/, 'Image'); // XXX is this really necessary?
2355 - var thumbWikiText = "[[" + thumbTitle + "|thumb]]";
 2371+ //var thumbTitle = upload.title.replace(/^File/, 'Image'); // XXX is this really necessary?
 2372+ var thumbWikiText = "[[" + upload.title + "|thumb]]";
23562373
23572374 thanksDiv.append(
23582375 $j( '<div class="mwe-upwiz-data"></div>' )
@@ -2370,7 +2387,7 @@
23712388 $j( '<textarea class="mwe-long-textarea" rows="1"/>' )
23722389 .growTextArea()
23732390 .append( thumbWikiText )
2374 - .trigger( 'change' ) // to make it grow to fit
 2391+ .resizeIfNeeded()
23752392 ),
23762393 $j('<p/>').append(
23772394 gM( 'mwe-upwiz-thanks-url' ),
@@ -2378,7 +2395,7 @@
23792396 $j( '<textarea class="mwe-long-textarea" rows="1"/>' )
23802397 .growTextArea()
23812398 .append( upload.imageinfo.descriptionurl )
2382 - .trigger( 'change' ) // to make it grow to fit
 2399+ .resizeIfNeeded()
23832400 )
23842401 )
23852402 );
@@ -2969,14 +2986,16 @@
29702987 } );
29712988 }
29722989
2973 - var resizeIfNeeded = function() {
 2990+ this.resizeIfNeeded = function() {
29742991 // this is the dom element
29752992 while (this.scrollHeight > this.offsetHeight) {
29762993 this.rows++;
29772994 }
 2995+ return this;
29782996 };
29792997
2980 - this.change(resizeIfNeeded).keyup(resizeIfNeeded);
 2998+ this.change(this.resizeIfNeeded);
 2999+ this.keyup(this.resizeIfNeeded);
29813000
29823001 return this;
29833002 };
Index: branches/js2-work/phase3/js/specialUploadWizardPage.js
@@ -4,6 +4,8 @@
55 */
66
77 mw.ready( function() {
 8+ var NS_FILE = 6; // Defines.php
 9+
810 mw.load( 'UploadWizard.UploadWizard', function () {
911
1012 mw.setConfig( 'debug', true );
@@ -23,6 +25,9 @@
2426 // so, this workaround will cause tagalog descriptions to be saved with this template instead.
2527 mw.setConfig( 'languageTemplateFixups', { tl: 'tgl' } );
2628 mw.setConfig( 'defaultLicenses', [ 'cc_by_sa_30' ] );
 29+
 30+ // usually, but not always, File:
 31+ mw.setConfig( 'fileNamespace', wgCanonicalNamespaceNames[NS_FILE] );
2732
2833 var uploadWizard = new mw.UploadWizard();
2934 uploadWizard.createInterface( '#upload-wizard' );

Status & tagging log