r69709 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69708‎ | r69709 | r69710 >
Date:21:55, 21 July 2010
Author:neilk
Status:deferred
Tags:
Comment:
comment and spacing fixes, made signature of execute() compatible with superclass
Modified paths:
  • /trunk/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php
@@ -13,7 +13,7 @@
1414
1515 // $request is the request (usually wgRequest)
1616 // $par is everything in the URL after Special:UploadWizard. Not sure what we can use it for
17 - public function __construct( $request=null ) {
 17+ public function __construct( $request=null ) {
1818 global $wgEnableJS2, $wgEnableAPI, $wgRequest;
1919
2020 if (! $wgEnableJS2) {
@@ -31,9 +31,14 @@
3232
3333 $this->simpleForm = new UploadWizardSimpleForm();
3434 $this->simpleForm->setTitle( $this->getTitle() );
35 - }
 35+ }
3636
37 - public function execute() {
 37+ /**
 38+ * Replaces default execute method
 39+ * Checks whether uploading enabled, user permissions okay,
 40+ * @param subpage, e.g. the "foo" in Special:UploadWizard/foo.
 41+ */
 42+ public function execute( $subPage ) {
3843 global $wgUser, $wgOut, $wgMessageCache;
3944
4045 # Check uploading enabled
@@ -82,16 +87,14 @@
8388 $this->simpleForm->show();
8489 $wgOut->addHTML('</noscript>');
8590
86 -
87 - //$j('#firstHeading').html("Upload wizard");
88 -
89 - $this->addJS();
 91+ $this->addJS( $subPage );
9092 }
9193
9294 /**
9395 * Adds some global variables for our use, as well as initializes the UploadWizard
 96+ * @param subpage, e.g. the "foo" in Special:UploadWizard/foo
9497 */
95 - public function addJS() {
 98+ public function addJS( $subPage ) {
9699 global $wgUser, $wgOut;
97100 global $wgUseAjax, $wgAjaxLicensePreview, $wgEnableAPI;
98101 global $wgEnableFirefogg, $wgFileExtensions;
@@ -105,23 +108,18 @@
106109 // what is acceptable in this wiki
107110 'wgFileExtensions' => $wgFileExtensions,
108111
 112+ // XXX page should fetch its own edit token
109113 // our edit token
110114 'wgEditToken' => $wgUser->editToken(),
 115+
 116+ 'wgSubPage' => $subPage
111117
112 - // 'wgFilenamePrefixBlacklist' => UploadBase::getFilenamePrefixBlacklist();
 118+ // XXX need to have a better function for testing viability of a filename
 119+ // 'wgFilenamePrefixBlacklist' => UploadBase::getFilenamePrefixBlacklist()
113120
114 -
115 - // in the future, we ought to be telling JS land other things,
116 - // like: requirements for publication, acceptable licenses, etc.
117 -
118121 ) )
119122 );
120123
121 -
122 -//
123 -// $initScript = <<<EOD
124 -//EOD;
125 -// $wgOut->addScript( Html::inlineScript( $initScript ) );
126124 // not sure why -- can we even load libraries with an included script, or does that cause things to be out of order?
127125 global $wgScriptPath;
128126 $wgOut->addNamedResource( 'UploadWizardPage', 'page');

Status & tagging log