mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Began interface for comment administration
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39725 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9099fa1474
commit
9f4c3d3196
@ -9,6 +9,7 @@ Director::addRules(50, array(
|
||||
'admin/newsletter/$Action/$ID' => 'NewsletterAdmin',
|
||||
'admin/reports/$Action/$ID' => 'ReportAdmin',
|
||||
'admin/assets/$Action/$ID' => 'AssetAdmin',
|
||||
'admin/feedback/$Action' => 'FeedbackAdmin',
|
||||
'admin/ReportField/$Action/$ID/$Type/$OtherID' => 'ReportField_Controller',
|
||||
'admin/bulkload/$Action/$ID/$OtherID' => 'BulkLoaderAdmin',
|
||||
'admin/$Action/$ID/$OtherID' => 'CMSMain',
|
||||
|
46
code/FeedbackAdmin.php
Normal file
46
code/FeedbackAdmin.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class FeedbackAdmin extends LeftAndMain {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
Requirements::javascript("cms/javascript/FeedbackAdmin_right.js");
|
||||
}
|
||||
|
||||
public function Link($action = null) {
|
||||
return "admin/feedback/$action";
|
||||
}
|
||||
|
||||
public function showtable($params) {
|
||||
return $this->getLastFormIn($this->renderWith('FeedbackAdmin_right'));
|
||||
}
|
||||
|
||||
public function EditForm() {
|
||||
$url = rtrim($_SERVER['REQUEST_URI'], '/');
|
||||
$section = substr($url, strrpos($url, '/') + 1);
|
||||
|
||||
if($section != 'accepted' && $section != 'unmoderated' && $section != 'spam') {
|
||||
$section = 'accepted';
|
||||
}
|
||||
|
||||
if($section == 'accepted') {
|
||||
$filter = 'IsSpam=0 AND NeedsModeration=0';
|
||||
} else if($section == 'unmoderation') {
|
||||
$filter = 'NeedsModeration=1';
|
||||
} else {
|
||||
$filter = 'IsSpam=1';
|
||||
}
|
||||
|
||||
$idField = new HiddenField('ID');
|
||||
$table = new ComplexTableField($this, "Comments", "PageComment", array("Name" => "Name", "Comment" => "Comment"), new FieldSet(), $filter);
|
||||
|
||||
$fields = new FieldSet($idField, $table);
|
||||
$actions = new FieldSet();
|
||||
$form = new Form($this, "EditForm", $fields, $actions);
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -154,6 +154,7 @@ abstract class LeftAndMain extends Controller {
|
||||
"Newsletters" => array("newsletter", "admin/newsletter/", "NewsletterAdmin"),
|
||||
"Reports" => array("report", "admin/reports/", "ReportAdmin"),
|
||||
"Security" => array("security", "admin/security/", "SecurityAdmin"),
|
||||
"Feedback" => array("feedback", "admin/feedback/", "FeedbackAdmin"),
|
||||
"Help" => array("help", "http://userhelp.silverstripe.com"),
|
||||
);
|
||||
|
||||
@ -641,7 +642,7 @@ JS;
|
||||
public function currentPageID() {
|
||||
if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID'])) {
|
||||
return $_REQUEST['ID'];
|
||||
} elseif (is_numeric($this->urlParams['ID'])) {
|
||||
} elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) {
|
||||
return $this->urlParams['ID'];
|
||||
} elseif(Session::get("{$this->class}.currentPage")) {
|
||||
return Session::get("{$this->class}.currentPage");
|
||||
|
18
javascript/FeedbackAdmin_right.js
Normal file
18
javascript/FeedbackAdmin_right.js
Normal file
@ -0,0 +1,18 @@
|
||||
Behaviour.register({
|
||||
'#Form_EditForm' : {
|
||||
getPageFromServer : function(id) {
|
||||
statusMessage("loading...");
|
||||
|
||||
var requestURL = 'admin/feedback/showtable/' + id;
|
||||
new Ajax.Request(requestURL, {
|
||||
asynchronous : true,
|
||||
method : 'post',
|
||||
postBody : 'ajax=1',
|
||||
onSuccess : this.successfullyReceivedPage.bind(this),
|
||||
onFailure : function(response) {
|
||||
errorMessage('error loading page',response);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
11
templates/Includes/FeedbackAdmin_SiteTree.ss
Normal file
11
templates/Includes/FeedbackAdmin_SiteTree.ss
Normal file
@ -0,0 +1,11 @@
|
||||
<ul id="sitetree" class="tree unformatted">
|
||||
<li id="comments">
|
||||
<a href="$baseURL/admin/feedback/showtable/accepted" title="Accepted">Accepted</a>
|
||||
</li>
|
||||
<li id="unmoderated">
|
||||
<a href="$baseURL/admin/feedback/showtable/unmoderated" title="Awaiting Moderation">Awaiting Moderation</a>
|
||||
</li>
|
||||
<li id="spam">
|
||||
<a href="$baseURL/admin/feedback/showtable/spam" title="Spam">Spam</a>
|
||||
</li>
|
||||
</ul>
|
7
templates/Includes/FeedbackAdmin_left.ss
Normal file
7
templates/Includes/FeedbackAdmin_left.ss
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="title"><div>Feedback</div></div>
|
||||
|
||||
<div id="treepanes">
|
||||
<div id="sitetree_holder">
|
||||
<% include FeedbackAdmin_SiteTree %>
|
||||
</div>
|
||||
</div>
|
11
templates/Includes/FeedbackAdmin_right.ss
Normal file
11
templates/Includes/FeedbackAdmin_right.ss
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="title"><div>Feedback Management</div></div>
|
||||
|
||||
<% if EditForm %>
|
||||
$EditForm
|
||||
<% else %>
|
||||
<form id="Form_EditForm" action="admin/feedback?executeForm=EditForm" method="post" enctype="multipart/form-data">
|
||||
<p>Welcome to the $ApplicationName feedback management. Please select a folder in the tree on the left.</p>
|
||||
</form>
|
||||
<% end_if %>
|
||||
|
||||
<p id="statusMessage" style="visibility:hidden"></p>
|
Loading…
Reference in New Issue
Block a user