FEATURE: If there is no Name set, but there is an author, use the author's name (from r89650)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@89827 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-10-21 04:53:24 +00:00
parent 780338c6d7
commit de82c4620a

View File

@ -45,6 +45,14 @@ class PageComment extends DataObject {
return $this->Parent()->Link() . '#PageComment_'. $this->ID;
}
function getRSSName() {
if($this->Name) {
return $this->Name;
} elseif($this->Author()) {
return $this->Author()->getName();
}
}
function ParsedBBCode(){
$parser = new BBCodeParser($this->Comment);
return $parser->parse();
@ -95,7 +103,7 @@ class PageComment extends DataObject {
function RSSTitle() {
return sprintf(
_t('PageComment.COMMENTBY', "Comment by '%s' on %s", PR_MEDIUM, 'Name, Page Title'),
Convert::raw2xml($this->Name),
Convert::raw2xml($this->getRSSName()),
$this->Parent()->Title
);
}
@ -173,7 +181,7 @@ class PageComment_Controller extends Controller {
$comments = new DataObjectSet();
}
$rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name");
$rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "RSSName");
$rss->outputToBrowser();
}