diff --git a/code/FeedbackAdmin.php b/code/FeedbackAdmin.php index 7fcffc6b..24d64b9a 100644 --- a/code/FeedbackAdmin.php +++ b/code/FeedbackAdmin.php @@ -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 << \ No newline at end of file diff --git a/javascript/FeedbackAdmin_right.js b/javascript/FeedbackAdmin_right.js index 8a97178d..8cf265a3 100644 --- a/javascript/FeedbackAdmin_right.js +++ b/javascript/FeedbackAdmin_right.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); } - }); + });*/ } } }); \ No newline at end of file diff --git a/templates/Includes/FeedbackAdmin_right.ss b/templates/Includes/FeedbackAdmin_right.ss index 5e7bcaef..937f95da 100644 --- a/templates/Includes/FeedbackAdmin_right.ss +++ b/templates/Includes/FeedbackAdmin_right.ss @@ -1,5 +1,8 @@
Feedback Management
+
+
+ <% if EditForm %> $EditForm <% else %>