mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Added deleting of marked comments
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39805 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a1cb5387a1
commit
4cbc4642b6
@ -18,6 +18,9 @@ class FeedbackAdmin extends LeftAndMain {
|
||||
|
||||
public function EditForm() {
|
||||
$url = rtrim($_SERVER['REQUEST_URI'], '/');
|
||||
if(strrpos($url, '&')) {
|
||||
$url = substr($url, 0, strrpos($url, '&'));
|
||||
}
|
||||
$section = substr($url, strrpos($url, '/') + 1);
|
||||
|
||||
if($section != 'accepted' && $section != 'unmoderated' && $section != 'spam') {
|
||||
@ -48,11 +51,39 @@ class FeedbackAdmin extends LeftAndMain {
|
||||
$table->setParentClass(false);
|
||||
|
||||
$fields = new FieldSet($idField, $table);
|
||||
$actions = new FieldSet();
|
||||
|
||||
$actions = new FieldSet(
|
||||
new FormAction('deletemarked', 'Delete')
|
||||
);
|
||||
|
||||
$form = new Form($this, "EditForm", $fields, $actions);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function deletemarked() {
|
||||
$numComments = 0;
|
||||
$folderID = 0;
|
||||
$deleteList = '';
|
||||
|
||||
if($_REQUEST['Comments']) {
|
||||
foreach($_REQUEST['Comments'] as $commentid) {
|
||||
$comment = DataObject::get_one('PageComment', "`PageComment`.ID = $commentid");
|
||||
if($comment) {
|
||||
$comment->delete();
|
||||
$numComments++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
user_error("No comments in $commentList could be found!", E_USER_ERROR);
|
||||
}
|
||||
|
||||
echo <<<JS
|
||||
$deleteList
|
||||
$('Form_EditForm').getPageFromServer($('Form_EditForm_ID').value);
|
||||
statusMessage("Deleted $numComments comments.");
|
||||
JS;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -4,7 +4,10 @@ Behaviour.register({
|
||||
statusMessage("loading...");
|
||||
|
||||
var requestURL = 'admin/feedback/showtable/' + id;
|
||||
new Ajax.Request(requestURL, {
|
||||
|
||||
this.loadURLFromServer(requestURL);
|
||||
|
||||
/*new Ajax.Request(requestURL, {
|
||||
asynchronous : true,
|
||||
method : 'post',
|
||||
postBody : 'ajax=1',
|
||||
@ -12,7 +15,7 @@ Behaviour.register({
|
||||
onFailure : function(response) {
|
||||
errorMessage('error loading page',response);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
});
|
@ -1,5 +1,8 @@
|
||||
<div class="title"><div>Feedback Management</div></div>
|
||||
|
||||
<div id="form_actions_right" class="ajaxActions">
|
||||
</div>
|
||||
|
||||
<% if EditForm %>
|
||||
$EditForm
|
||||
<% else %>
|
||||
|
Loading…
Reference in New Issue
Block a user