r47482 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47481‎ | r47482 | r47483 >
Date:08:43, 19 February 2009
Author:raymond
Status:ok (Comments)
Tags:
Comment:
* Some cleanup for Special:Import:
** Do not show input field for import depth if $wgExportMaxLinkDepth == 0
** Add missing 'mw-label' for 2 labels
** Change class 'mw-label' to 'mw-submit' for the submit button for consistency with other forms
** Remove FIXME note as nothing to fix :)
** Add IDs to input forms
** Use specific Xml::fieldset functions
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialImport.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialImport.php
@@ -66,13 +66,13 @@
6767 * Do the actual import
6868 */
6969 private function doImport() {
70 - global $wgOut, $wgRequest, $wgUser, $wgImportSources;
 70+ global $wgOut, $wgRequest, $wgUser, $wgImportSources, $wgExportMaxLinkDepth;
7171 $isUpload = false;
7272 $this->namespace = $wgRequest->getIntOrNull( 'namespace' );
7373 $sourceName = $wgRequest->getVal( "source" );
7474
7575 $this->logcomment = $wgRequest->getText( 'log-comment' );
76 - $this->pageLinkDepth = $wgRequest->getIntOrNull( 'pagelink-depth' );
 76+ $this->pageLinkDepth = $wgExportMaxLinkDepth == 0 ? 0 : $wgRequest->getIntOrNull( 'pagelink-depth' );
7777
7878 if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'editToken' ) ) ) {
7979 $source = new WikiErrorMsg( 'import-token-mismatch' );
@@ -132,9 +132,7 @@
133133 }
134134
135135 private function showForm() {
136 - global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources;
137 - # FIXME: Quick hack to disable import for non privileged users /Raymond
138 - # Regression from 43963
 136+ global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources, $wgExportMaxLinkDepth;
139137 if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
140138 return $wgOut->permissionRequired( 'import' );
141139
@@ -143,9 +141,9 @@
144142 if( $wgUser->isAllowed( 'importupload' ) ) {
145143 $wgOut->addWikiMsg( "importtext" );
146144 $wgOut->addHTML(
147 - Xml::openElement( 'fieldset' ).
148 - Xml::element( 'legend', null, wfMsg( 'import-upload' ) ) .
149 - Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action ) ) .
 145+ Xml::fieldset( wfMsg( 'import-upload' ) ).
 146+ Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post',
 147+ 'action' => $action, 'id' => 'mw-import-upload-form' ) ) .
150148 Xml::hidden( 'action', 'submit' ) .
151149 Xml::hidden( 'source', 'upload' ) .
152150 Xml::openElement( 'table', array( 'id' => 'mw-import-table' ) ) .
@@ -169,7 +167,7 @@
170168 </tr>
171169 <tr>
172170 <td></td>
173 - <td class='mw-input'>" .
 171+ <td class='mw-submit'>" .
174172 Xml::submitButton( wfMsg( 'uploadbtn' ) ) .
175173 "</td>
176174 </tr>" .
@@ -185,10 +183,22 @@
186184 }
187185
188186 if( $wgUser->isAllowed( 'import' ) && !empty( $wgImportSources ) ) {
 187+ # Show input field for import depth only if $wgExportMaxLinkDepth > 0
 188+ $importDepth = '';
 189+ if( $wgExportMaxLinkDepth > 0 ) {
 190+ $importDepth = "<tr>
 191+ <td class='mw-label'>" .
 192+ wfMsgExt( 'export-pagelinks', 'parseinline' ) .
 193+ "</td>
 194+ <td class='mw-input'>" .
 195+ Xml::input( 'pagelink-depth', 3, 0 ) .
 196+ "</td>
 197+ </tr>";
 198+ }
 199+
189200 $wgOut->addHTML(
190 - Xml::openElement( 'fieldset' ) .
191 - Xml::element( 'legend', null, wfMsg( 'importinterwiki' ) ) .
192 - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action ) ) .
 201+ Xml::fieldset( wfMsg( 'importinterwiki' ) ) .
 202+ Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form' ) ) .
193203 wfMsgExt( 'import-interwiki-text', array( 'parse' ) ) .
194204 Xml::hidden( 'action', 'submit' ) .
195205 Xml::hidden( 'source', 'interwiki' ) .
@@ -205,6 +215,7 @@
206216 $selected = ( $this->interwiki === $prefix ) ? ' selected="selected"' : '';
207217 $wgOut->addHTML( Xml::option( $prefix, $prefix, $selected ) );
208218 }
 219+
209220 $wgOut->addHTML(
210221 Xml::closeElement( 'select' ) .
211222 Xml::input( 'frompage', 50, $this->frompage ) .
@@ -224,12 +235,9 @@
225236 Xml::checkLabel( wfMsg( 'import-interwiki-templates' ), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates ) .
226237 "</td>
227238 </tr>
 239+ $importDepth
228240 <tr>
229 - <td>".wfMsgExt( 'export-pagelinks', 'parseinline' )."</td>
230 - <td class=\"mw-input\">" . Xml::input( 'pagelink-depth', 20, 0 ) . "<br/>
231 - </tr>
232 - <tr>
233 - <td>" .
 241+ <td class='mw-label'>" .
234242 Xml::label( wfMsg( 'import-interwiki-namespace' ), 'namespace' ) .
235243 "</td>
236244 <td class='mw-input'>" .
@@ -248,7 +256,7 @@
249257 <tr>
250258 <td>
251259 </td>
252 - <td class='mw-input'>" .
 260+ <td class='mw-submit'>" .
253261 Xml::submitButton( wfMsg( 'import-interwiki-submit' ), array( 'accesskey' => 's' ) ) .
254262 "</td>
255263 </tr>" .
Index: trunk/phase3/RELEASE-NOTES
@@ -230,6 +230,8 @@
231231 * (bug 17502) meta=siteinfo&siprop=namespacealiases no longer lists namespace
232232 aliases already listed in siprop=namespaces
233233 * (bug 17529) rvend ignored when rvstartid is specified
 234+* Special:Import: Do not show input field for import depth if
 235+ $wgExportMaxLinkDepth == 0
234236
235237 === Languages updated in 1.15 ===
236238

Follow-up revisions

RevisionCommit summaryAuthorDate
r47538Fix for r47482: put the RELEASE-NOTES entry in the "bug fixes" section and no...ialex10:55, 20 February 2009

Comments

#Comment by Aaron Schulz (talk | contribs)   23:09, 3 March 2009

Line 93, Column 38: reference to non-existent ID "xmlimport".

#Comment by Raymond (talk | contribs)   17:16, 4 March 2009

Can you check line/column pls? I do not see a relation to this commit. I have tested the xmlimport today and it works. Maybe I am blind but I do not see an error.

Status & tagging log