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

@ -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 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
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 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
public function getEditForm($id = null, $fields = null) {
$fields = new FieldList();
$report = $this->currentReport();
$report = $this->reportObject;
if($report) {
// List all reports