From 72e90545454c0e014318fa3c81658e035aac58c1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 10 Jun 2009 13:00:47 +0200 Subject: applying patch to version 1.15.0 --- includes/specials/SpecialImport.php | 52 +++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) (limited to 'includes/specials/SpecialImport.php') diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 5e1a6533..457e03b4 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -30,6 +30,7 @@ class SpecialImport extends SpecialPage { private $frompage = ''; private $logcomment= false; private $history = true; + private $includeTemplates = false; /** * Constructor @@ -65,12 +66,13 @@ class SpecialImport extends SpecialPage { * Do the actual import */ private function doImport() { - global $wgOut, $wgRequest, $wgUser, $wgImportSources; + global $wgOut, $wgRequest, $wgUser, $wgImportSources, $wgExportMaxLinkDepth; $isUpload = false; $this->namespace = $wgRequest->getIntOrNull( 'namespace' ); $sourceName = $wgRequest->getVal( "source" ); $this->logcomment = $wgRequest->getText( 'log-comment' ); + $this->pageLinkDepth = $wgExportMaxLinkDepth == 0 ? 0 : $wgRequest->getIntOrNull( 'pagelink-depth' ); if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'editToken' ) ) ) { $source = new WikiErrorMsg( 'import-token-mismatch' ); @@ -88,10 +90,13 @@ class SpecialImport extends SpecialPage { } else { $this->history = $wgRequest->getCheck( 'interwikiHistory' ); $this->frompage = $wgRequest->getText( "frompage" ); + $this->includeTemplates = $wgRequest->getCheck( 'interwikiTemplates' ); $source = ImportStreamSource::newFromInterwiki( $this->interwiki, $this->frompage, - $this->history ); + $this->history, + $this->includeTemplates, + $this->pageLinkDepth ); } } else { $source = new WikiErrorMsg( "importunknownsource" ); @@ -127,9 +132,7 @@ class SpecialImport extends SpecialPage { } private function showForm() { - global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources; - # FIXME: Quick hack to disable import for non privileged users /Raymond - # Regression from 43963 + global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources, $wgExportMaxLinkDepth; if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) ) return $wgOut->permissionRequired( 'import' ); @@ -138,9 +141,9 @@ class SpecialImport extends SpecialPage { if( $wgUser->isAllowed( 'importupload' ) ) { $wgOut->addWikiMsg( "importtext" ); $wgOut->addHTML( - Xml::openElement( 'fieldset' ). - Xml::element( 'legend', null, wfMsg( 'import-upload' ) ) . - Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action ) ) . + Xml::fieldset( wfMsg( 'import-upload' ) ). + Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', + 'action' => $action, 'id' => 'mw-import-upload-form' ) ) . Xml::hidden( 'action', 'submit' ) . Xml::hidden( 'source', 'upload' ) . Xml::openElement( 'table', array( 'id' => 'mw-import-table' ) ) . @@ -164,7 +167,7 @@ class SpecialImport extends SpecialPage { - " . + " . Xml::submitButton( wfMsg( 'uploadbtn' ) ) . " " . @@ -180,10 +183,22 @@ class SpecialImport extends SpecialPage { } if( $wgUser->isAllowed( 'import' ) && !empty( $wgImportSources ) ) { + # Show input field for import depth only if $wgExportMaxLinkDepth > 0 + $importDepth = ''; + if( $wgExportMaxLinkDepth > 0 ) { + $importDepth = " + " . + wfMsgExt( 'export-pagelinks', 'parseinline' ) . + " + " . + Xml::input( 'pagelink-depth', 3, 0 ) . + " + "; + } + $wgOut->addHTML( - Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, wfMsg( 'importinterwiki' ) ) . - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action ) ) . + Xml::fieldset( wfMsg( 'importinterwiki' ) ) . + Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form' ) ) . wfMsgExt( 'import-interwiki-text', array( 'parse' ) ) . Xml::hidden( 'action', 'submit' ) . Xml::hidden( 'source', 'interwiki' ) . @@ -200,6 +215,7 @@ class SpecialImport extends SpecialPage { $selected = ( $this->interwiki === $prefix ) ? ' selected="selected"' : ''; $wgOut->addHTML( Xml::option( $prefix, $prefix, $selected ) ); } + $wgOut->addHTML( Xml::closeElement( 'select' ) . Xml::input( 'frompage', 50, $this->frompage ) . @@ -213,7 +229,15 @@ class SpecialImport extends SpecialPage { " - " . + + + " . + Xml::checkLabel( wfMsg( 'import-interwiki-templates' ), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates ) . + " + + $importDepth + + " . Xml::label( wfMsg( 'import-interwiki-namespace' ), 'namespace' ) . " " . @@ -232,7 +256,7 @@ class SpecialImport extends SpecialPage { - " . + " . Xml::submitButton( wfMsg( 'import-interwiki-submit' ), array( 'accesskey' => 's' ) ) . " " . -- cgit v1.2.3-54-g00ecf