Skip to content

Commit

Permalink
BUGFIX: SSF-168 fixing bug in report admin where back button didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Seidenberg committed Apr 5, 2012
1 parent 4c76c85 commit b1e286c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions code/controllers/ReportAdmin.php
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b1e286c

Please sign in to comment.