mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Allow specifying the page in page comment rss feeds
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39681 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3e5a0968ae
commit
475b872eb8
@ -5,6 +5,7 @@ class PageComment extends DataObject {
|
|||||||
"Name" => "Varchar",
|
"Name" => "Varchar",
|
||||||
"Comment" => "Text",
|
"Comment" => "Text",
|
||||||
"IsSpam" => "Boolean",
|
"IsSpam" => "Boolean",
|
||||||
|
"NeedsModeration" => "Boolean"
|
||||||
);
|
);
|
||||||
|
|
||||||
static $has_one = array(
|
static $has_one = array(
|
||||||
@ -18,6 +19,8 @@ class PageComment extends DataObject {
|
|||||||
// Number of comments to show before paginating
|
// Number of comments to show before paginating
|
||||||
static $comments_per_page = 10;
|
static $comments_per_page = 10;
|
||||||
|
|
||||||
|
static $moderate = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a link to this comment
|
* Return a link to this comment
|
||||||
* @return string link to this comment.
|
* @return string link to this comment.
|
||||||
@ -135,10 +138,19 @@ class PageComment extends DataObject {
|
|||||||
return "Comment by '". Convert::raw2xml($this->Name) . "' on " . $this->Parent()->Title;
|
return "Comment by '". Convert::raw2xml($this->Name) . "' on " . $this->Parent()->Title;
|
||||||
}
|
}
|
||||||
function rss() {
|
function rss() {
|
||||||
$rss = new RSSFeed(DataObject::get("PageComment", "ParentID > 0", "Created DESC", "", 10), "home/", "Page comments", "", "RSSTitle", "Comment", "Name");
|
$parentcheck = isset($_REQUEST['pageid']) ? "ParentID = {$_REQUEST['pageid']}" : "ParentID > 0";
|
||||||
|
$comments = DataObject::get("PageComment", $parentcheck, "Created DESC", "", 10);
|
||||||
|
if(!isset($comments)) {
|
||||||
|
$comments = new DataObjectSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
$rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name");
|
||||||
$rss->outputToBrowser();
|
$rss->outputToBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function enableModeration() {
|
||||||
|
self::$moderate = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user