Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1397,6 +1397,7 @@ |
1398 | 1398 | 'export-submit', |
1399 | 1399 | 'export-addcattext', |
1400 | 1400 | 'export-addcat', |
| 1401 | + 'export-download', |
1401 | 1402 | ), |
1402 | 1403 | 'allmessages' => array( |
1403 | 1404 | 'allmessages', |
Index: trunk/phase3/includes/SpecialExport.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | * |
55 | 55 | */ |
56 | 56 | function wfSpecialExport( $page = '' ) { |
57 | | - global $wgOut, $wgRequest, $wgExportAllowListContributors; |
| 57 | + global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors; |
58 | 58 | global $wgExportAllowHistory, $wgExportMaxHistory; |
59 | 59 | |
60 | 60 | $curonly = true; |
— | — | @@ -131,6 +131,11 @@ |
132 | 132 | // This should provide safer streaming for pages with history |
133 | 133 | wfResetOutputBuffers(); |
134 | 134 | header( "Content-type: application/xml; charset=utf-8" ); |
| 135 | + if( $wgRequest->getCheck( 'wpDownload' ) ) { |
| 136 | + // Provide a sane filename suggestion |
| 137 | + $filename = $wgSitename . '-' . wfTimestampNow() . '.xml'; |
| 138 | + $wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" ); |
| 139 | + } |
135 | 140 | $pages = explode( "\n", $page ); |
136 | 141 | |
137 | 142 | $db = wfGetDB( DB_SLAVE ); |
— | — | @@ -164,25 +169,28 @@ |
165 | 170 | return; |
166 | 171 | } |
167 | 172 | |
168 | | - $wgOut->addWikiText( wfMsg( "exporttext" ) ); |
169 | | - $titleObj = SpecialPage::getTitleFor( "Export" ); |
| 173 | + $self = SpecialPage::getTitleFor( 'Export' ); |
| 174 | + $wgOut->addHtml( wfMsgExt( 'exporttext', 'parse' ) ); |
170 | 175 | |
171 | | - $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalUrl() ) ); |
172 | | - |
173 | | - $form .= wfInputLabel( wfMsg( 'export-addcattext' ), 'catname', 'catname', 40 ) . ' '; |
174 | | - $form .= wfSubmitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />'; |
175 | | - |
176 | | - $form .= wfOpenElement( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ) ) . htmlspecialchars($page). '</textarea><br />'; |
177 | | - |
| 176 | + $form = Xml::openElement( 'form', array( 'method' => 'post', |
| 177 | + 'action' => $self->getLocalUrl( 'action=submit' ) ) ); |
| 178 | + |
| 179 | + $form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' '; |
| 180 | + $form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />'; |
| 181 | + |
| 182 | + $form .= Xml::openElement( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ) ); |
| 183 | + $form .= htmlspecialchars( $page ); |
| 184 | + $form .= Xml::closeElement( 'textarea' ); |
| 185 | + $form .= '<br />'; |
| 186 | + |
178 | 187 | if( $wgExportAllowHistory ) { |
179 | | - $form .= wfCheck( 'curonly', true, array( 'value' => 'true', 'id' => 'curonly' ) ); |
180 | | - $form .= wfLabel( wfMsg( 'exportcuronly' ), 'curonly' ) . '<br />'; |
| 188 | + $form .= Xml::checkLabel( wfMsg( 'exportcuronly' ), 'curonly', 'curonly', true ) . '<br />'; |
181 | 189 | } else { |
182 | | - $wgOut->addWikiText( wfMsg( 'exportnohistory' ) ); |
| 190 | + $wgOut->addHtml( wfMsgExt( 'exportnohistory', 'parse' ) ); |
183 | 191 | } |
184 | | - $form .= wfHidden( 'action', 'submit' ); |
185 | | - $form .= wfSubmitButton( wfMsg( 'export-submit' ) ) . '</form>'; |
| 192 | + $form .= Xml::checkLabel( wfMsg( 'export-download' ), 'wpDownload', 'wpDownload', true ) . '<br />'; |
| 193 | + |
| 194 | + $form .= Xml::submitButton( wfMsg( 'export-submit' ) ); |
| 195 | + $form .= Xml::closeElement( 'form' ); |
186 | 196 | $wgOut->addHtml( $form ); |
187 | | -} |
188 | | - |
189 | | - |
| 197 | +} |
\ No newline at end of file |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2110,13 +2110,14 @@ |
2111 | 2111 | select whether you want the current version as well as all old versions, with the page |
2112 | 2112 | history lines, or just the current version with the info about the last edit. |
2113 | 2113 | |
2114 | | -In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{MediaWiki:mainpage}}]] for the page {{MediaWiki:mainpage}}.', |
| 2114 | +In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{MediaWiki:mainpage}}]] for the page "[[{{MediaWiki:mainpage}}]]".', |
2115 | 2115 | 'exportcuronly' => 'Include only the current revision, not the full history', |
2116 | 2116 | 'exportnohistory' => "---- |
2117 | 2117 | '''Note:''' Exporting the full history of pages through this form has been disabled due to performance reasons.", |
2118 | 2118 | 'export-submit' => 'Export', |
2119 | 2119 | 'export-addcattext' => 'Add pages from category:', |
2120 | 2120 | 'export-addcat' => 'Add', |
| 2121 | +'export-download' => 'Offer to save as a file', |
2121 | 2122 | |
2122 | 2123 | # Namespace 8 related |
2123 | 2124 | 'allmessages' => 'System messages', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -148,6 +148,8 @@ |
149 | 149 | than good. Proper handheld support will be added at a future date. For now, |
150 | 150 | display should be acceptable either with CSS turned off or when using a so- |
151 | 151 | phisticated handheld browser. |
| 152 | +* (bug 3173) Option to offer exported pages as a download, rather than displaying |
| 153 | + inline, as in most browsers |
152 | 154 | |
153 | 155 | == Bugfixes since 1.10 == |
154 | 156 | |