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

This commit is contained in:
Julian Seidenberg 2012-04-05 13:04:59 +12:00
parent 4c76c8563c
commit b1e286cb23

View File

@ -23,9 +23,22 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
static $tree_class = 'SS_Report'; 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() { public function init() {
parent::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'); Requirements::css(CMS_DIR . '/css/screen.css');
// Set custom options for TinyMCE specific to ReportAdmin // Set custom options for TinyMCE specific to ReportAdmin
@ -58,12 +71,6 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
return false; 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 * Return a SS_List of SS_Report subclasses
* that are available for use. * that are available for use.
@ -111,7 +118,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
public function getEditForm($id = null, $fields = null) { public function getEditForm($id = null, $fields = null) {
$fields = new FieldList(); $fields = new FieldList();
$report = $this->currentReport(); $report = $this->reportObject;
if($report) { if($report) {
// List all reports // List all reports