Index: trunk/phase3/includes/specials/SpecialImport.php |
— | — | @@ -28,6 +28,7 @@ |
29 | 29 | private $interwiki = false; |
30 | 30 | private $namespace; |
31 | 31 | private $frompage = ''; |
| 32 | + private $logcomment= false; |
32 | 33 | private $history = true; |
33 | 34 | |
34 | 35 | /** |
— | — | @@ -69,6 +70,8 @@ |
70 | 71 | $this->namespace = $wgRequest->getIntOrNull( 'namespace' ); |
71 | 72 | $sourceName = $wgRequest->getVal( "source" ); |
72 | 73 | |
| 74 | + $this->logcomment = $wgRequest->getText( 'log-comment' ); |
| 75 | + |
73 | 76 | if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'editToken' ) ) ) { |
74 | 77 | $source = new WikiErrorMsg( 'import-token-mismatch' ); |
75 | 78 | } elseif ( $sourceName == 'upload' ) { |
— | — | @@ -103,7 +106,7 @@ |
104 | 107 | if( !is_null( $this->namespace ) ) { |
105 | 108 | $importer->setTargetNamespace( $this->namespace ); |
106 | 109 | } |
107 | | - $reporter = new ImportReporter( $importer, $isUpload, $this->interwiki ); |
| 110 | + $reporter = new ImportReporter( $importer, $isUpload, $this->interwiki , $this->logcomment); |
108 | 111 | |
109 | 112 | $reporter->open(); |
110 | 113 | $result = $importer->doImport(); |
— | — | @@ -135,9 +138,26 @@ |
136 | 139 | Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action ) ) . |
137 | 140 | Xml::hidden( 'action', 'submit' ) . |
138 | 141 | Xml::hidden( 'source', 'upload' ) . |
| 142 | + Xml::openElement( 'table', array( 'id' => 'mw-import-table' ) ) . |
| 143 | + |
| 144 | + "<tr> |
| 145 | + <td>" . |
139 | 146 | Xml::input( 'xmlimport', 50, '', array( 'type' => 'file' ) ) . ' ' . |
| 147 | + "</td> |
| 148 | + </tr> |
| 149 | + <tr> |
| 150 | + <td>" . |
| 151 | + Xml::label( wfMsg('import-upload-comment'), 'comment' ) . |
| 152 | + Xml::input( 'log-comment', 50, '', array( 'type' => 'text' ) ) . ' ' . |
| 153 | + "</td> |
| 154 | + </tr> |
| 155 | + <tr> |
| 156 | + <td>" . |
| 157 | + Xml::submitButton( wfMsg( 'uploadbtn' ) ) . |
| 158 | + "</td> |
| 159 | + </tr>" . |
| 160 | + Xml::closeElement( 'table' ). |
140 | 161 | Xml::hidden( 'editToken', $wgUser->editToken() ) . |
141 | | - Xml::submitButton( wfMsg( 'uploadbtn' ) ) . |
142 | 162 | Xml::closeElement( 'form' ) . |
143 | 163 | Xml::closeElement( 'fieldset' ) |
144 | 164 | ); |
— | — | @@ -188,6 +208,14 @@ |
189 | 209 | "</td> |
190 | 210 | </tr> |
191 | 211 | <tr> |
| 212 | + <td>" . |
| 213 | + Xml::label( wfMsg( 'import-comment' ), 'comment' ) . |
| 214 | + "</td> |
| 215 | + <td>" . |
| 216 | + Xml::input( 'log-comment', 50, '', array( 'type' => 'text' ) ) . ' ' . |
| 217 | + "</td> |
| 218 | + </tr> |
| 219 | + <tr> |
192 | 220 | <td> |
193 | 221 | </td> |
194 | 222 | <td>" . |
— | — | @@ -207,11 +235,14 @@ |
208 | 236 | * @ingroup SpecialPage |
209 | 237 | */ |
210 | 238 | class ImportReporter { |
211 | | - function __construct( $importer, $upload, $interwiki ) { |
| 239 | + private $reason=false; |
| 240 | + |
| 241 | + function __construct( $importer, $upload, $interwiki , $reason=false ) { |
212 | 242 | $importer->setPageOutCallback( array( $this, 'reportPage' ) ); |
213 | 243 | $this->mPageCount = 0; |
214 | 244 | $this->mIsUpload = $upload; |
215 | 245 | $this->mInterwiki = $interwiki; |
| 246 | + $this->reason = $reason; |
216 | 247 | } |
217 | 248 | |
218 | 249 | function open() { |
— | — | @@ -239,12 +270,18 @@ |
240 | 271 | if( $this->mIsUpload ) { |
241 | 272 | $detail = wfMsgExt( 'import-logentry-upload-detail', array( 'content', 'parsemag' ), |
242 | 273 | $contentCount ); |
| 274 | + if ($this->reason) { |
| 275 | + $detail .= ' (' . $this->reason .')'; |
| 276 | + } |
243 | 277 | $log->addEntry( 'upload', $title, $detail ); |
244 | 278 | } else { |
245 | 279 | $interwiki = '[[:' . $this->mInterwiki . ':' . |
246 | 280 | $origTitle->getPrefixedText() . ']]'; |
247 | 281 | $detail = wfMsgExt( 'import-logentry-interwiki-detail', array( 'content', 'parsemag' ), |
248 | 282 | $contentCount, $interwiki ); |
| 283 | + if ($this->reason) { |
| 284 | + $detail .= ' (' . $this->reason .')'; |
| 285 | + } |
249 | 286 | $log->addEntry( 'interwiki', $title, $detail ); |
250 | 287 | } |
251 | 288 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2790,6 +2790,8 @@ |
2791 | 2791 | 'import-interwiki-history' => 'Copy all history versions for this page', |
2792 | 2792 | 'import-interwiki-submit' => 'Import', |
2793 | 2793 | 'import-interwiki-namespace' => 'Transfer pages into namespace:', |
| 2794 | +'import-upload-comment' => 'Comment:', |
| 2795 | +'import-comment' => 'Comment:', |
2794 | 2796 | 'importtext' => 'Please export the file from the source wiki using the [[Special:Export|export utility]]. |
2795 | 2797 | Save it to your computer and upload it here.', |
2796 | 2798 | 'importstart' => 'Importing pages...', |