Index: trunk/extensions/DataTransfer/specials/DT_ImportCSV.php |
— | — | @@ -79,14 +79,18 @@ |
80 | 80 | $encoding = $wgRequest->getVal( 'encoding' ); |
81 | 81 | $pages = array(); |
82 | 82 | $error_msg = self::getCSVData( $source->mHandle, $encoding, $pages ); |
83 | | - if ( ! is_null( $error_msg ) ) |
| 83 | + if ( ! is_null( $error_msg ) ) { |
84 | 84 | $text .= $error_msg; |
85 | | - else |
86 | | - $text .= self::modifyPages( $pages ); |
| 85 | + } else { |
| 86 | + $importSummary = $wgRequest->getVal( 'import_summary' ); |
| 87 | + $text .= self::modifyPages( $pages, $importSummary ); |
| 88 | + } |
87 | 89 | } |
88 | 90 | } else { |
89 | 91 | $select_file_label = wfMsg( 'dt_import_selectfile', 'CSV' ); |
90 | 92 | $encoding_type_label = wfMsg( 'dt_import_encodingtype' ); |
| 93 | + $import_summary_label = wfMsg( 'dt_import_summarydesc' ); |
| 94 | + $default_summary = wfMsgForContent( 'dt_import_editsummary', 'CSV' ); |
91 | 95 | $import_button = wfMsg( 'import-interwiki-submit' ); |
92 | 96 | $text = <<<END |
93 | 97 | <p>$select_file_label</p> |
— | — | @@ -95,7 +99,10 @@ |
96 | 100 | <p>$encoding_type_label: <select name="encoding"> |
97 | 101 | <option selected value="utf8">UTF-8</option> |
98 | 102 | <option value="utf16">UTF-16</option> |
99 | | - </select> |
| 103 | + </select></p> |
| 104 | + <p>$import_summary_label |
| 105 | + <input type="text" name="import_summary" value="$default_summary" /> |
| 106 | + </p> |
100 | 107 | <p><input type="Submit" name="import_file" value="$import_button"></p> |
101 | 108 | </form> |
102 | 109 | |
— | — | @@ -160,24 +167,26 @@ |
161 | 168 | } |
162 | 169 | } |
163 | 170 | |
164 | | - function modifyPages( $pages ) { |
| 171 | + function modifyPages( $pages, $editSummary ) { |
| 172 | + global $wgUser, $wgLang; |
| 173 | + |
165 | 174 | $text = ""; |
166 | 175 | $jobs = array(); |
167 | | - $job_params = array(); |
168 | | - global $wgUser; |
169 | | - $job_params['user_id'] = $wgUser->getId(); |
170 | | - $job_params['edit_summary'] = wfMsgForContent( 'dt_import_editsummary', 'CSV' ); |
| 176 | + $jobParams = array(); |
| 177 | + $jobParams['user_id'] = $wgUser->getId(); |
| 178 | + $jobParams['edit_summary'] = $editSummary; |
171 | 179 | foreach ( $pages as $page ) { |
172 | 180 | $title = Title::newFromText( $page->getName() ); |
173 | 181 | if ( is_null( $title ) ) { |
174 | 182 | $text .= '<p>' . wfMsg( 'img-auth-badtitle', $page->getName() ) . "</p>\n"; |
175 | 183 | continue; |
176 | 184 | } |
177 | | - $job_params['text'] = $page->createText(); |
178 | | - $jobs[] = new DTImportJob( $title, $job_params ); |
| 185 | + $jobParams['text'] = $page->createText(); |
| 186 | + $jobs[] = new DTImportJob( $title, $jobParams ); |
179 | 187 | } |
180 | 188 | Job::batchInsert( $jobs ); |
181 | | - $text .= wfMsg( 'dt_import_success', count( $jobs ), 'CSV' ); |
| 189 | + $text .= wfMsgExt( 'dt_import_success', array( 'parse' ), $wgLang->formatNum( count( $jobs ) ), 'CSV' ); |
| 190 | + |
182 | 191 | return $text; |
183 | 192 | } |
184 | 193 | |