Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -234,14 +234,6 @@ |
235 | 235 | return; |
236 | 236 | } |
237 | 237 | |
238 | | - $wgOut->addModules( 'mediawiki.action.edit' ); |
239 | | - |
240 | | - if ( $wgUser->getOption( 'uselivepreview', false ) ) { |
241 | | - $wgOut->addModules( 'mediawiki.legacy.preview' ); |
242 | | - } |
243 | | - // Bug #19334: textarea jumps when editing articles in IE8 |
244 | | - $wgOut->addStyle( 'common/IE80Fixes.css', 'screen', 'IE 8' ); |
245 | | - |
246 | 238 | wfProfileIn( __METHOD__."-business-end" ); |
247 | 239 | |
248 | 240 | $this->isConflict = false; |
— | — | @@ -253,38 +245,10 @@ |
254 | 246 | $this->isNew = !$this->mTitle->exists() || $this->section == 'new'; |
255 | 247 | |
256 | 248 | # Show applicable editing introductions |
257 | | - if ( $this->formtype == 'initial' || $this->firsttime ) |
| 249 | + if ( $this->formtype == 'initial' || $this->firsttime ) { |
258 | 250 | $this->showIntro(); |
259 | | - |
260 | | - if ( $this->mTitle->isTalkPage() ) { |
261 | | - $wgOut->addWikiMsg( 'talkpagetext' ); |
262 | 251 | } |
263 | 252 | |
264 | | - # Optional notices on a per-namespace and per-page basis |
265 | | - $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace(); |
266 | | - $editnotice_ns_message = wfMessage( $editnotice_ns )->inContentLanguage(); |
267 | | - if ( $editnotice_ns_message->exists() ) { |
268 | | - $wgOut->addWikiText( $editnotice_ns_message->plain() ); |
269 | | - } |
270 | | - if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) { |
271 | | - $parts = explode( '/', $this->mTitle->getDBkey() ); |
272 | | - $editnotice_base = $editnotice_ns; |
273 | | - while ( count( $parts ) > 0 ) { |
274 | | - $editnotice_base .= '-'.array_shift( $parts ); |
275 | | - $editnotice_base_msg = wfMessage( $editnotice_base )->inContentLanguage(); |
276 | | - if ( $editnotice_base_msg->exists() ) { |
277 | | - $wgOut->addWikiText( $editnotice_base_msg->plain() ); |
278 | | - } |
279 | | - } |
280 | | - } else { |
281 | | - # Even if there are no subpages in namespace, we still don't want / in MW ns. |
282 | | - $editnoticeText = $editnotice_ns . '-' . str_replace( '/', '-', $this->mTitle->getDBkey() ); |
283 | | - $editnoticeMsg = wfMessage( $editnoticeText )->inContentLanguage(); |
284 | | - if ( $editnoticeMsg->exists() ) { |
285 | | - $wgOut->addWikiText( $editnoticeMsg->plain() ); |
286 | | - } |
287 | | - } |
288 | | - |
289 | 253 | # Attempt submission here. This will check for edit conflicts, |
290 | 254 | # and redundantly check for locked database, blocked IPs, etc. |
291 | 255 | # that edit() already checked just in case someone tries to sneak |
— | — | @@ -1526,8 +1490,21 @@ |
1527 | 1491 | } |
1528 | 1492 | |
1529 | 1493 | function setHeaders() { |
1530 | | - global $wgOut; |
| 1494 | + global $wgOut, $wgUser; |
| 1495 | + |
| 1496 | + $wgOut->addModules( 'mediawiki.action.edit' ); |
| 1497 | + |
| 1498 | + if ( $wgUser->getOption( 'uselivepreview', false ) ) { |
| 1499 | + $wgOut->addModules( 'mediawiki.legacy.preview' ); |
| 1500 | + } |
| 1501 | + // Bug #19334: textarea jumps when editing articles in IE8 |
| 1502 | + $wgOut->addStyle( 'common/IE80Fixes.css', 'screen', 'IE 8' ); |
| 1503 | + |
1531 | 1504 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 1505 | + |
| 1506 | + # Enabled article-related sidebar, toplinks, etc. |
| 1507 | + $wgOut->setArticleRelated( true ); |
| 1508 | + |
1532 | 1509 | if ( $this->isConflict ) { |
1533 | 1510 | $wgOut->setPageTitle( wfMessage( 'editconflict', $this->getContextTitle()->getPrefixedText() ) ); |
1534 | 1511 | } elseif ( $this->section != '' ) { |
— | — | @@ -1651,9 +1628,6 @@ |
1652 | 1629 | |
1653 | 1630 | $this->setHeaders(); |
1654 | 1631 | |
1655 | | - # Enabled article-related sidebar, toplinks, etc. |
1656 | | - $wgOut->setArticleRelated( true ); |
1657 | | - |
1658 | 1632 | if ( $this->showHeader() === false ) { |
1659 | 1633 | wfProfileOut( __METHOD__ ); |
1660 | 1634 | return; |
— | — | @@ -1804,6 +1778,36 @@ |
1805 | 1779 | |
1806 | 1780 | protected function showHeader() { |
1807 | 1781 | global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang; |
| 1782 | + |
| 1783 | + if ( $this->mTitle->isTalkPage() ) { |
| 1784 | + $wgOut->addWikiMsg( 'talkpagetext' ); |
| 1785 | + } |
| 1786 | + |
| 1787 | + # Optional notices on a per-namespace and per-page basis |
| 1788 | + $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace(); |
| 1789 | + $editnotice_ns_message = wfMessage( $editnotice_ns )->inContentLanguage(); |
| 1790 | + if ( $editnotice_ns_message->exists() ) { |
| 1791 | + $wgOut->addWikiText( $editnotice_ns_message->plain() ); |
| 1792 | + } |
| 1793 | + if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) { |
| 1794 | + $parts = explode( '/', $this->mTitle->getDBkey() ); |
| 1795 | + $editnotice_base = $editnotice_ns; |
| 1796 | + while ( count( $parts ) > 0 ) { |
| 1797 | + $editnotice_base .= '-'.array_shift( $parts ); |
| 1798 | + $editnotice_base_msg = wfMessage( $editnotice_base )->inContentLanguage(); |
| 1799 | + if ( $editnotice_base_msg->exists() ) { |
| 1800 | + $wgOut->addWikiText( $editnotice_base_msg->plain() ); |
| 1801 | + } |
| 1802 | + } |
| 1803 | + } else { |
| 1804 | + # Even if there are no subpages in namespace, we still don't want / in MW ns. |
| 1805 | + $editnoticeText = $editnotice_ns . '-' . str_replace( '/', '-', $this->mTitle->getDBkey() ); |
| 1806 | + $editnoticeMsg = wfMessage( $editnoticeText )->inContentLanguage(); |
| 1807 | + if ( $editnoticeMsg->exists() ) { |
| 1808 | + $wgOut->addWikiText( $editnoticeMsg->plain() ); |
| 1809 | + } |
| 1810 | + } |
| 1811 | + |
1808 | 1812 | if ( $this->isConflict ) { |
1809 | 1813 | $wgOut->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1\n</div>", 'explainconflict' ); |
1810 | 1814 | $this->edittime = $this->mArticle->getTimestamp(); |