Merged revisions 52296 via svnmerge from

http://svn.silverstripe.com/open/modules/cms/branches/2.2.2

........
  r52296 | aoneil | 2008-04-08 12:28:37 +1200 (Tue, 08 Apr 2008) | 2 lines
  
  Fix pagecomment links and feeds
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@53496 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-04-26 06:38:48 +00:00
parent 83db9bfa3b
commit e395446f66
2 changed files with 65 additions and 56 deletions

View File

@ -17,6 +17,8 @@ Director::addRules(50, array(
'admin/bulkload/$Action/$ID/$OtherID' => 'BulkLoaderAdmin',
'admin/ImageEditor/$Action' => 'ImageEditor',
'admin/$Action/$ID/$OtherID' => 'CMSMain',
'unsubscribe/$Email/$MailingList' => 'Unsubscribe_Controller',
'PageComment/$Action/$ID' => 'PageComment_Controller'
));
// Built-in modules

View File

@ -51,20 +51,6 @@ class PageComment extends DataObject {
return "PageComment/deletecomment/$this->ID";
}
}
function deletecomment() {
if(Permission::check('CMS_ACCESS_CMSMain')) {
$comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']);
if($comment) {
$comment->delete();
}
}
if(Director::is_ajax()) {
echo "";
} else {
Director::redirectBack();
}
}
function SpamLink() {
$member = Member::currentUser();
@ -95,7 +81,69 @@ class PageComment extends DataObject {
}
}
function approve() {
function RSSTitle() {
return sprintf(
_t('PageComment.COMMENTBY', "Comment by '%s' on %s", PR_MEDIUM, 'Name, Page Title'),
Convert::raw2xml($this->Name),
$this->Parent()->Title
);
}
function PageTitle() {
return $this->Parent()->Title;
}
static function enableModeration() {
self::$moderate = true;
}
static function moderationEnabled() {
return self::$moderate;
}
static function enableBBCode() {
self::$bbcode = true;
}
static function bbCodeEnabled() {
return self::$bbcode;
}
}
class PageComment_Controller extends Controller {
function rss() {
$parentcheck = isset($_REQUEST['pageid']) ? "ParentID = " . (int) $_REQUEST['pageid'] : "ParentID > 0";
$comments = DataObject::get("PageComment", "$parentcheck AND IsSpam=0", "Created DESC", "", 10);
if(!isset($comments)) {
$comments = new DataObjectSet();
}
$rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name");
$rss->outputToBrowser();
}
function deletecomment() {
if(Permission::check('CMS_ACCESS_CMSMain')) {
$comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']);
if($comment) {
$comment->delete();
}
}
if(Director::is_ajax()) {
echo "";
} else {
Director::redirectBack();
}
}
function approve() {
if(Permission::check('CMS_ACCESS_CMSMain')) {
$comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']);
$comment->NeedsModeration = false;
@ -174,47 +222,6 @@ 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),
$this->Parent()->Title
);
}
function rss() {
$parentcheck = isset($_REQUEST['pageid']) ? "ParentID = " . (int) $_REQUEST['pageid'] : "ParentID > 0";
$comments = DataObject::get("PageComment", "$parentcheck AND IsSpam=0", "Created DESC", "", 10);
if(!isset($comments)) {
$comments = new DataObjectSet();
}
$rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name");
$rss->outputToBrowser();
}
function PageTitle() {
return $this->Parent()->Title;
}
static function enableModeration() {
self::$moderate = true;
}
static function moderationEnabled() {
return self::$moderate;
}
static function enableBBCode() {
self::$bbcode = true;
}
static function bbCodeEnabled() {
return self::$bbcode;
}
}
?>