Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3461
patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:29 PM
2014-11-21 21:29:59 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
patch
View Options
Index: includes/EditPage.php
===================================================================
--- includes/EditPage.php (revision 17755)
+++ includes/EditPage.php (working copy)
@@ -928,6 +929,10 @@
$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' );
@@ -1005,7 +1010,7 @@
if ( $wgUser->getOption( 'previewontop' ) ) {
if ( 'preview' == $this->formtype ) {
- $this->showPreview();
+ $this->showPreview( $previewOutput );
} else {
$wgOut->addHTML( '<div id="wikiPreview"></div>' );
}
@@ -1035,7 +1040,7 @@
if( !$this->preview && !$this->diff ) {
$wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus()' );
}
- $templates = $sk->formatTemplates( $this->preview ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates() );
+ $templates = $sk->formatTemplates( $this->preview || $this->section != '' ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates(), $this->preview, $this->section != '' );
global $wgUseMetadataEdit ;
if ( $wgUseMetadataEdit ) {
@@ -1223,7 +1228,7 @@
if ( !$wgUser->getOption( 'previewontop' ) ) {
if ( $this->formtype == 'preview') {
- $this->showPreview();
+ $this->showPreview( $previewOutput );
} else {
$wgOut->addHTML( '<div id="wikiPreview"></div>' );
}
@@ -1240,17 +1245,18 @@
/**
* Append preview output to $wgOut.
* Includes category rendering if this is a category page.
+ *
* @private
+ * @param $text The HTML to be output for the preview
*/
- function showPreview() {
+ 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();
}
Index: includes/Linker.php
===================================================================
--- includes/Linker.php (revision 17755)
+++ includes/Linker.php (working copy)
@@ -1133,9 +1133,11 @@
*
* @param array $templates Array of templates from Article::getUsedTemplate
* or similar
+ * @param bool $preview If this is for a preview
+ * @param bool $section If 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__ );
@@ -1152,7 +1154,7 @@
# 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>';
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 17755)
+++ languages/messages/MessagesEn.php (working copy)
@@ -979,6 +980,7 @@
'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.
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3029
Default Alt Text
patch (3 KB)
Attached To
Mode
T9918: update "Pages transcluded onto ... this page:" on edit preview
Attached
Detach File
Event Timeline
Log In to Comment