r66592 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66591‎ | r66592 | r66593 >
Date:23:01, 17 May 2010
Author:neilk
Status:deferred
Tags:
Comment:
Configuration changes.
- configure with one big object, rather than multiple calls to mw.setConfig.
- configure the namespace of media files (usually File: or Image: but this can change)
- started to configure with blacklist of media files; will reconsider approach... current system is glob based on
backend and regex based on frontend (commons form). should be unified.
Modified paths:
  • /trunk/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardPage.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php
@@ -94,7 +94,7 @@
9595 public function addJS() {
9696 global $wgUser, $wgOut;
9797 global $wgUseAjax, $wgAjaxLicensePreview, $wgEnableAPI;
98 - global $wgEnableFirefogg, $wgFileExtensions;
 98+ global $wgEnableFirefogg, $wgFileExtensions, $wgCanonicalNamespaceNames;
9999
100100 $wgOut->addScript( Skin::makeVariablesScript( array(
101101 // uncertain if this is relevant. Can we do license preview with API?
@@ -106,8 +106,14 @@
107107 'wgFileExtensions' => $wgFileExtensions,
108108
109109 // our edit token
110 - 'wgEditToken' => $wgUser->editToken()
 110+ 'wgEditToken' => $wgUser->editToken(),
111111
 112+ // URL prefixes in this MediaWiki, e.g. images under Image:
 113+ 'wgCanonicalNamespaceNames' => $wgCanonicalNamespaceNames
 114+
 115+ // 'wgFilenamePrefixBlacklist' => UploadBase::getFilenamePrefixBlacklist();
 116+
 117+
112118 // in the future, we ought to be telling JS land other things,
113119 // like: requirements for publication, acceptable licenses, etc.
114120
Index: trunk/extensions/UploadWizard/UploadWizardPage.js
@@ -4,24 +4,49 @@
55 */
66
77 mw.ready( function() {
 8+
 9+ // The namespace for media files. We use this to look up what the URL prefix is on this MediaWiki, usually
 10+ // 'Image:' or something like that. Defined in defines.php
 11+ var NS_FILE = 6;
 12+
813 mw.load( 'UploadWizard.UploadWizard', function () {
914 mw.setConfig( 'debug', true );
1015
1116 mw.setDefaultConfig( 'uploadHandlerClass', null );
12 - mw.setConfig( 'userName', wgUserName );
13 - mw.setConfig( 'userLanguage', wgUserLanguage );
14 - mw.setConfig( 'fileExtensions', wgFileExtensions );
15 - mw.setConfig( 'token', wgEditToken );
16 - mw.setConfig( 'thumbnailWidth', 120 );
1717
18 - // not for use with all wikis.
19 - // The ISO 639 code for the language tagalog is "tl".
20 - // Normally we name templates for languages by the ISO 639 code.
21 - // Commons already had a template called 'tl', though.
22 - // so, this workaround will cause tagalog descriptions to be saved with this template instead.
23 - mw.setConfig( 'languageTemplateFixups', { tl: 'tgl' } );
24 - mw.setConfig( 'defaultLicenses', [ 'cc_by_sa_30', 'gfdl' ] );
 18+ mw.setConfig( {
 19+ debug: true,
 20+ userName: wgUserName,
 21+ userLanguage: wgUserLanguage,
 22+ fileExtensions: wgFileExtensions,
 23+ token: wgEditToken,
 24+ thumbnailWidth: 120,
 25+ smallThumbnailWidth: 60,
2526
 27+ // not for use with all wikis.
 28+ // The ISO 639 code for the language tagalog is "tl".
 29+ // Normally we name templates for languages by the ISO 639 code.
 30+ // Commons already had a template called 'tl: though.
 31+ // so, this workaround will cause tagalog descriptions to be saved with this template instead.
 32+ languageTemplateFixups: { tl: 'tgl' },
 33+ defaultLicenses: [ 'cc_by_sa_30' ],
 34+
 35+ // usually, but not always, File:
 36+ fileNamespace: wgCanonicalNamespaceNames[NS_FILE],
 37+
 38+
 39+ // XXX this is horribly confusing -- some file restrictions are client side, others are server side
 40+ // the filename prefix blacklist is at least server side -- all this should be replaced with PHP regex config
 41+ //
 42+ // we can export these to JS if we so want.
 43+ // filenamePrefixBlacklist: wgFilenamePrefixBlacklist,
 44+ //
 45+ // filenameRegexBlacklist: [
 46+ // /^(test|image|img|bild|example?[\s_-]*)$/, // test stuff
 47+ // /^(\d{10}[\s_-][0-9a-f]{10}[\s_-][a-z])$/ // flickr
 48+ // ]
 49+ });
 50+
2651 var uploadWizard = new mw.UploadWizard();
2752 uploadWizard.createInterface( '#upload-wizard' );
2853

Status & tagging log