Add Comment blocks
This commit is contained in:
parent
6bf1708772
commit
55fedab565
|
@ -459,6 +459,15 @@ class CommentingController extends Controller
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a form for updating an existing comment.
|
||||||
|
*
|
||||||
|
* Extend the existing form to post a comment to update a comment.
|
||||||
|
* Add an extra frield and preload existing data.
|
||||||
|
*
|
||||||
|
* @param Comment $comment
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
public function UpdateForm($comment)
|
public function UpdateForm($comment)
|
||||||
{
|
{
|
||||||
$form = $this->CommentsForm();
|
$form = $this->CommentsForm();
|
||||||
|
@ -499,6 +508,15 @@ class CommentingController extends Controller
|
||||||
return $this->httpError(404);
|
return $this->httpError(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request handler for update form.
|
||||||
|
*
|
||||||
|
* Get Comment to be updated and build an update form.
|
||||||
|
*
|
||||||
|
* @param HTTPRequest $request
|
||||||
|
* @throws HTTPResponse_Exception
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
public function updateComment(HTTPRequest $request)
|
public function updateComment(HTTPRequest $request)
|
||||||
{
|
{
|
||||||
if ($commentID = $request->param('ParentCommentID')) {
|
if ($commentID = $request->param('ParentCommentID')) {
|
||||||
|
|
|
@ -381,6 +381,12 @@ class Comment extends DataObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the comment can be updated by its author.
|
||||||
|
*
|
||||||
|
* @param null|int|Member $member
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
public function canUpdate($member = null)
|
public function canUpdate($member = null)
|
||||||
{
|
{
|
||||||
$member = $this->getMember($member);
|
$member = $this->getMember($member);
|
||||||
|
|
Loading…
Reference in New Issue