$wgUseSiteJs is enabled, in addition to (if applicable) MediaWiki:Monobook.js
and user JS subpages.
* (bug 7918) "Templates used on this page" changes during preview to reflect
- any added or removed templates.
-* (bug 7918) "Templates used on this page" is now shown for read-only pages.
+ any added or removed templates, and works as expected for section edits.
+* (bug 7919) "Templates used on this page" is now shown for read-only pages.
* (bug 7688) When viewing diff, section anchors in autosummary jump to section
on current page instead of loading the latest version.
* (bug 7970) Use current connection explicitly on Database::getServerVersion
$wgOut->addWikiText( wfMsg( 'longpagewarning', $wgLang->formatNum( $this->kblength ) ) );
}
+ #need to parse the preview early so that we know which templates are used,
+ #otherwise users with "show preview after edit box" will get a blank list
+ $previewOutput = $this->getPreviewText();
+
$rows = $wgUser->getIntOption( 'rows' );
$cols = $wgUser->getIntOption( 'cols' );
if ( $wgUser->getOption( 'previewontop' ) ) {
if ( 'preview' == $this->formtype ) {
- $this->showPreview();
+ $this->showPreview( $previewOutput );
} else {
$wgOut->addHTML( '<div id="wikiPreview"></div>' );
}
if( !$this->preview && !$this->diff ) {
$wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus()' );
}
- $templates = $sk->formatTemplates( $this->preview ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates() );
+ $templates = ($this->preview || $this->section) ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates();
+ $templates = $sk->formatTemplates( $templates, $this->preview, $this->section != '');
global $wgUseMetadataEdit ;
if ( $wgUseMetadataEdit ) {
if ( !$wgUser->getOption( 'previewontop' ) ) {
if ( $this->formtype == 'preview') {
- $this->showPreview();
+ $this->showPreview( $previewOutput );
} else {
$wgOut->addHTML( '<div id="wikiPreview"></div>' );
}
/**
* Append preview output to $wgOut.
* Includes category rendering if this is a category page.
- * @private
+ *
+ * @param string $text The HTML to be output for the preview.
*/
- function showPreview() {
+ private function showPreview( $text ) {
global $wgOut;
$wgOut->addHTML( '<div id="wikiPreview">' );
if($this->mTitle->getNamespace() == NS_CATEGORY) {
$this->mArticle->openShowCategory();
}
- $previewOutput = $this->getPreviewText();
- $wgOut->addHTML( $previewOutput );
+ $wgOut->addHTML( $text );
if($this->mTitle->getNamespace() == NS_CATEGORY) {
$this->mArticle->closeShowCategory();
}
* @package MediaWiki
*/
class Linker {
-
function Linker() {}
/**
*
* @param array $templates Array of templates from Article::getUsedTemplate
* or similar
+ * @param bool $preview Whether this is for a preview
+ * @param bool $section Whether this is for a section edit
* @return string HTML output
*/
- public function formatTemplates($templates) {
+ public function formatTemplates( $templates, $preview = false, $section = false) {
global $wgUser;
wfProfileIn( __METHOD__ );
# Construct the HTML
$outText = '<div class="mw-templatesUsedExplanation">' .
- wfMsgExt( 'templatesused', array( 'parse' ) ) .
+ wfMsgExt( 'templatesused' . ( $preview ? 'preview' : ( $section ? 'section' : '' ) ), array( 'parse' ) ) .
'</div><ul>';
foreach ( $templates as $titleObj ) {
$outText .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it.",
'templatesused' => 'Templates used on this page:',
'templatesusedpreview' => 'Templates used in this preview:',
+'templatesusedsection' => 'Templates used in this section:',
'edittools' => '<!-- Text here will be shown below edit and upload forms. -->',
'nocreatetitle' => 'Page creation limited',
'nocreatetext' => 'This site has restricted the ability to create new pages.