Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | |
15 | 15 | // $request is the request (usually wgRequest) |
16 | 16 | // $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 ) { |
18 | 18 | global $wgEnableJS2, $wgEnableAPI, $wgRequest; |
19 | 19 | |
20 | 20 | if (! $wgEnableJS2) { |
— | — | @@ -31,9 +31,14 @@ |
32 | 32 | |
33 | 33 | $this->simpleForm = new UploadWizardSimpleForm(); |
34 | 34 | $this->simpleForm->setTitle( $this->getTitle() ); |
35 | | - } |
| 35 | + } |
36 | 36 | |
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 ) { |
38 | 43 | global $wgUser, $wgOut, $wgMessageCache; |
39 | 44 | |
40 | 45 | # Check uploading enabled |
— | — | @@ -82,16 +87,14 @@ |
83 | 88 | $this->simpleForm->show(); |
84 | 89 | $wgOut->addHTML('</noscript>'); |
85 | 90 | |
86 | | - |
87 | | - //$j('#firstHeading').html("Upload wizard"); |
88 | | - |
89 | | - $this->addJS(); |
| 91 | + $this->addJS( $subPage ); |
90 | 92 | } |
91 | 93 | |
92 | 94 | /** |
93 | 95 | * Adds some global variables for our use, as well as initializes the UploadWizard |
| 96 | + * @param subpage, e.g. the "foo" in Special:UploadWizard/foo |
94 | 97 | */ |
95 | | - public function addJS() { |
| 98 | + public function addJS( $subPage ) { |
96 | 99 | global $wgUser, $wgOut; |
97 | 100 | global $wgUseAjax, $wgAjaxLicensePreview, $wgEnableAPI; |
98 | 101 | global $wgEnableFirefogg, $wgFileExtensions; |
— | — | @@ -105,23 +108,18 @@ |
106 | 109 | // what is acceptable in this wiki |
107 | 110 | 'wgFileExtensions' => $wgFileExtensions, |
108 | 111 | |
| 112 | + // XXX page should fetch its own edit token |
109 | 113 | // our edit token |
110 | 114 | 'wgEditToken' => $wgUser->editToken(), |
| 115 | + |
| 116 | + 'wgSubPage' => $subPage |
111 | 117 | |
112 | | - // 'wgFilenamePrefixBlacklist' => UploadBase::getFilenamePrefixBlacklist(); |
| 118 | + // XXX need to have a better function for testing viability of a filename |
| 119 | + // 'wgFilenamePrefixBlacklist' => UploadBase::getFilenamePrefixBlacklist() |
113 | 120 | |
114 | | - |
115 | | - // in the future, we ought to be telling JS land other things, |
116 | | - // like: requirements for publication, acceptable licenses, etc. |
117 | | - |
118 | 121 | ) ) |
119 | 122 | ); |
120 | 123 | |
121 | | - |
122 | | -// |
123 | | -// $initScript = <<<EOD |
124 | | -//EOD; |
125 | | -// $wgOut->addScript( Html::inlineScript( $initScript ) ); |
126 | 124 | // not sure why -- can we even load libraries with an included script, or does that cause things to be out of order? |
127 | 125 | global $wgScriptPath; |
128 | 126 | $wgOut->addNamedResource( 'UploadWizardPage', 'page'); |