* (bug 2832) [[Special:Listadmins]] redirects to [[Special:Listusers/sysop]]
* (bug 785) Parser did not get out of <pre> with list elements
* Some shared upload fixes
+* (bug 2768) section=new on nonexistent talk page does not add heading
+* support preload= parameter for section=new
+* show comment subject in preview when using section=new
+* use comment form when creating a new talk page
* (bug 460) Properly handle <center> tags as a block.
=== Caveats ===
if ( 0 == $this->getID() ) {
if ( 'edit' == $action ) {
wfProfileOut( $fname );
- # Should we put something in the textarea?
- # if &preload=Pagename is set, we try to get
- # the revision text and put it in.
- if($preload) {
- $preloadTitle=Title::newFromText($preload);
- if(isset($preloadTitle) && $preloadTitle->userCanRead()) {
- $rev=Revision::newFromTitle($preloadTitle);
- if($rev) {
- return $rev->getText();
- }
- }
- }
- # Don't preload anything.
- # We used to put MediaWiki:Newarticletext here.
+
+ # If requested, preload some text.
+ $text=$this->getPreloadedText($preload);
+
+ # We used to put MediaWiki:Newarticletext here if
+ # $text was empty at this point.
# This is now shown above the edit box instead.
- return '';
+ return $text;
}
wfProfileOut( $fname );
$wgOut->setRobotpolicy( 'noindex,nofollow' );
if($section!='') {
if($section=='new') {
wfProfileOut( $fname );
- return '';
+ $text=$this->getPreloadedText($preload);
+ return $text;
}
# strip NOWIKI etc. to avoid confusion (true-parameter causes HTML
}
}
+ /**
+ This function accepts a title string as parameter
+ ($preload). If this string is non-empty, it attempts
+ to fetch the current revision text.
+ */
+ function getPreloadedText($preload) {
+ if($preload) {
+ $preloadTitle=Title::newFromText($preload);
+ if(isset($preloadTitle) && $preloadTitle->userCanRead()) {
+ $rev=Revision::newFromTitle($preloadTitle);
+ if($rev) {
+ return $rev->getText();
+ }
+ }
+ }
+ return '';
+ }
+
/**
* This function returns the text of a section, specified by a number ($section).
* A section is text under a heading like == Heading == or <h1>Heading</h1>, or
* errors at some point.
* @private
*/
- function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC=false ) {
+ function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC=false, $comment=false ) {
global $wgOut, $wgUser;
global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
$ns = $this->mTitle->getNamespace();
$ttl = $this->mTitle->getDBkey();
+
+ # If this is a comment, add the summary as headline
+ if($comment && $summary!="") {
+ $text="== {$summary} ==\n\n".$text;
+ }
$text = $this->preSaveTransform( $text );
$isminor = ( $isminor && $wgUser->isLoggedIn() ) ? 1 : 0;
$now = wfTimestampNow();
// css / js subpages of user pages get a special treatment
$isCssJsSubpage = $wgTitle->isCssJsSubpage();
+ # If we're creating a discussion page, use the standard comment
+ # form.
+ if(!$wgTitle->exists() && $wgTitle->isTalkPage()) {
+ $this->section='new';
+ }
if(!$this->mTitle->getArticleID()) { # new article
$editintro = $wgRequest->getText( 'editintro' );
}
}
if($addstandardintro) {
- $wgOut->addWikiText(wfmsg('newarticletext'));
+ $wgOut->addWikiText(wfmsg('newarticletext'));
}
}
}
if (wfRunHooks('ArticleSave', array(&$this->mArticle, &$wgUser, &$this->textbox1,
&$this->summary, &$this->minoredit, &$this->watchthis, NULL)))
- {
+ {
+
+ $isComment=($this->section=='new');
$this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
- $this->minoredit, $this->watchthis );
+ $this->minoredit, $this->watchthis, false, $isComment);
wfRunHooks('ArticleSaveComplete', array(&$this->mArticle, &$wgUser, $this->textbox1,
$this->summary, $this->minoredit,
$this->watchthis, NULL));
$this->textbox1 = $this->mArticle->getContent(true);
}
- $toparse = $this->textbox1 ;
+ $toparse = $this->textbox1;
+
+ # If we're adding a comment, we need to show the
+ # summary as the headline
+ if($this->section=="new" && $this->summary!="") {
+ $toparse="== {$this->summary} ==\n\n".$toparse;
+ }
+
if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData ;
$parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ) ."\n\n",