Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1878,17 +1878,28 @@ |
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | # don't parse user css/js, show message about preview |
1882 | | - # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here |
| 1882 | + # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago? |
1883 | 1883 | |
1884 | | - if ( $this->isCssJsSubpage ) { |
| 1884 | + if ( $this->isCssJsSubpage || $this->mTitle->isCssOrJsPage() ) { |
| 1885 | + $level = 'user'; |
| 1886 | + if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
| 1887 | + $level = 'global'; |
| 1888 | + } |
| 1889 | + |
1885 | 1890 | if (preg_match( "/\\.css$/", $this->mTitle->getText() ) ) { |
1886 | | - $previewtext = "<div id='mw-usercsspreview'>\n" . wfMsg( 'usercsspreview' ) . "\n</div>"; |
1887 | | - } else if (preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { |
1888 | | - $previewtext = "<div id='mw-userjspreview'>\n" . wfMsg( 'userjspreview' ) . "\n</div>"; |
| 1891 | + $previewtext = "<div id='mw-{$level}csspreview'>\n" . wfMsg( "{$level}csspreview" ) . "\n</div>"; |
| 1892 | + $class = "mw-code mw-js"; |
| 1893 | + } elseif (preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { |
| 1894 | + $previewtext = "<div id='mw-{$level}jspreview'>\n" . wfMsg( "{$level}jspreview" ) . "\n</div>"; |
| 1895 | + $class = "mw-code mw-js"; |
| 1896 | + } else { |
| 1897 | + throw new MWException( 'A CSS/JS (sub)page but which is not css nor js!' ); |
1889 | 1898 | } |
| 1899 | + |
1890 | 1900 | $parserOptions->setTidy( true ); |
1891 | 1901 | $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); |
1892 | 1902 | $previewHTML = $parserOutput->mText; |
| 1903 | + $previewHTML .= "<pre class=\"$class\" dir=\"ltr\">\n" . htmlspecialchars( $this->textbox1 ) . "\n</pre>\n"; |
1893 | 1904 | } else { |
1894 | 1905 | $rt = Title::newFromRedirectArray( $this->textbox1 ); |
1895 | 1906 | if ( $rt ) { |
Index: trunk/phase3/languages/messages/MessagesQqq.php |
— | — | @@ -838,6 +838,10 @@ |
839 | 839 | 'clearyourcache' => 'Text at the top of .js/.css pages', |
840 | 840 | 'usercssyoucanpreview' => "Text displayed on every css page. The 'Show preview' part should be the same as {{msg-mw|showpreview}} (or you can use <nowiki>{{int:showpreview}}</nowiki>).", |
841 | 841 | 'userjsyoucanpreview' => 'Text displayed on every js page.', |
| 842 | +'usercsspreview' => 'Text displayed on preview of every user .css subpage', |
| 843 | +'userjspreview' => 'Text displayed on preview of every user .js subpage', |
| 844 | +'globalcsspreview' => 'Text displayed on preview of .css pages in MediaWiki namespace', |
| 845 | +'globaljspreview' => 'Text displayed on preview of .js pages in MediaWiki namespace', |
842 | 846 | 'updated' => '{{Identical|Updated}}', |
843 | 847 | 'previewnote' => 'Note displayed when clicking on Show preview', |
844 | 848 | 'editing' => "Shown as page title when editing a page. \$1 is the name of the page that is being edited. Example: \"''Editing Main Page''\".", |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1300,6 +1300,10 @@ |
1301 | 1301 | '''It has not yet been saved!'''", |
1302 | 1302 | 'userjspreview' => "'''Remember that you are only testing/previewing your user JavaScript.''' |
1303 | 1303 | '''It has not yet been saved!'''", |
| 1304 | +'globalcsspreview' => "'''Remember that you are only previewing this global CSS.''' |
| 1305 | +'''It has not yet been saved!'''", |
| 1306 | +'globaljspreview' => "'''Remember that you are only previewing this global JavaScript code.''' |
| 1307 | +'''It has not yet been saved!'''", |
1304 | 1308 | 'userinvalidcssjstitle' => "'''Warning:''' There is no skin \"\$1\". |
1305 | 1309 | Custom .css and .js pages use a lowercase title, e.g. {{ns:user}}:Foo/vector.css as opposed to {{ns:user}}:Foo/Vector.css.", |
1306 | 1310 | 'updated' => '(Updated)', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -467,6 +467,8 @@ |
468 | 468 | * rebuildFileCache.php no longer creates inappropriate cache files for redirects |
469 | 469 | * (bug 23119) WikiError class and subclasses are now marked as deprecated |
470 | 470 | * (bug 18372) $wgFileExtensions will now override $wgFileBlacklist |
| 471 | +* (bug 10871) Javascript and CSS pages in MediaWiki namespace are no longer treated |
| 472 | + as wikitext on preview. |
471 | 473 | |
472 | 474 | === API changes in 1.17 === |
473 | 475 | * (bug 22738) Allow filtering by action type on query=logevent. |