Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUGFIX: SSF-168 fixing bug in report admin where back button didn't work

  • Loading branch information...
commit b1e286cb23c3ea914b86dad9fa549a77ebb949f8 1 parent 4c76c85
@candidasa candidasa authored
Showing with 14 additions and 7 deletions.
  1. +14 −7 code/controllers/ReportAdmin.php
View
21 code/controllers/ReportAdmin.php
@@ -22,10 +22,23 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
static $template_path = null; // defaults to (project)/templates/email
static $tree_class = 'SS_Report';
+
+ /**
+ * Variable that describes which report we are currently viewing based on the URL (gets set in init method)
+ * @var String
+ */
+ protected $reportClass;
+
+ protected $reportObject;
public function init() {
parent::init();
+ //set the report we are currently viewing from the URL
+ $this->reportClass = (isset($this->urlParams['ID'])) ? $this->urlParams['ID'] : null;
+ $allReports = SS_Report::get_reports();
+ $this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;
+
Requirements::css(CMS_DIR . '/css/screen.css');
// Set custom options for TinyMCE specific to ReportAdmin
@@ -58,12 +71,6 @@ function canView($member = null) {
return false;
}
- function currentReport() {
- $id = parent::currentPageID();
- $reports = SS_Report::get_reports();
- return (isset($reports[$id])) ? $reports[$id] : null;
- }
-
/**
* Return a SS_List of SS_Report subclasses
* that are available for use.
@@ -111,7 +118,7 @@ function providePermissions() {
public function getEditForm($id = null, $fields = null) {
$fields = new FieldList();
- $report = $this->currentReport();
+ $report = $this->reportObject;
if($report) {
// List all reports
Please sign in to comment.
Something went wrong with that request. Please try again.