mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUG Fix broken form actions on parent and nested gridfields
This commit is contained in:
parent
8a5741aa00
commit
9d31bb0542
@ -158,9 +158,9 @@ class SS_Report extends ViewableData
|
|||||||
|
|
||||||
public function getLink($action = null)
|
public function getLink($action = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
return Controller::join_links(
|
return Controller::join_links(
|
||||||
AdminRootController::admin_url(),
|
ReportAdmin::singleton()->Link('show'),
|
||||||
Config::inst()->get('ReportAdmin', 'url_segment'),
|
|
||||||
get_class($this),
|
get_class($this),
|
||||||
$action
|
$action
|
||||||
);
|
);
|
||||||
|
@ -18,11 +18,8 @@ use SilverStripe\Security\PermissionProvider;
|
|||||||
*/
|
*/
|
||||||
class ReportAdmin extends LeftAndMain implements PermissionProvider
|
class ReportAdmin extends LeftAndMain implements PermissionProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
private static $url_segment = 'reports';
|
private static $url_segment = 'reports';
|
||||||
|
|
||||||
private static $url_rule = '/$ReportClass/$Action';
|
|
||||||
|
|
||||||
private static $menu_title = 'Reports';
|
private static $menu_title = 'Reports';
|
||||||
|
|
||||||
private static $template_path = null; // defaults to (project)/templates/email
|
private static $template_path = null; // defaults to (project)/templates/email
|
||||||
@ -30,7 +27,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
private static $tree_class = 'SS_Report';
|
private static $tree_class = 'SS_Report';
|
||||||
|
|
||||||
private static $url_handlers = array(
|
private static $url_handlers = array(
|
||||||
'$ReportClass/$Action' => 'handleAction'
|
'show/$ReportClass/$Action' => 'handleAction'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,13 +47,6 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
//set the report we are currently viewing from the URL
|
|
||||||
$this->reportClass = (isset($this->urlParams['ReportClass']) && $this->urlParams['ReportClass'] !== 'index')
|
|
||||||
? $this->urlParams['ReportClass']
|
|
||||||
: null;
|
|
||||||
$allReports = SS_Report::get_reports();
|
|
||||||
$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;
|
|
||||||
|
|
||||||
// Set custom options for TinyMCE specific to ReportAdmin
|
// Set custom options for TinyMCE specific to ReportAdmin
|
||||||
HTMLEditorConfig::get('cms')->setOption('content_css', project() . '/css/editor.css');
|
HTMLEditorConfig::get('cms')->setOption('content_css', project() . '/css/editor.css');
|
||||||
HTMLEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang());
|
HTMLEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang());
|
||||||
@ -111,6 +101,22 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function handleAction($request, $action) {
|
||||||
|
$this->reportClass = $request->param('ReportClass');
|
||||||
|
|
||||||
|
// Check report
|
||||||
|
if ($this->reportClass) {
|
||||||
|
$allReports = SS_Report::get_reports();
|
||||||
|
if (empty($allReports[$this->reportClass])) {
|
||||||
|
return $this->httpError(404);
|
||||||
|
}
|
||||||
|
$this->reportObject = $allReports[$this->reportClass];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delegate to sub-form
|
||||||
|
return parent::handleAction($request, $action);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if we have reports and need
|
* Determine if we have reports and need
|
||||||
* to display the "Reports" main menu item
|
* to display the "Reports" main menu item
|
||||||
@ -162,13 +168,8 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
return $this->reportObject->getLink($action);
|
return $this->reportObject->getLink($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join parent action
|
|
||||||
if($action) {
|
|
||||||
return static::join_links(parent::Link('index'), $action);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Basic link to this cms section
|
// Basic link to this cms section
|
||||||
return parent::Link();
|
return parent::Link($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providePermissions()
|
public function providePermissions()
|
||||||
|
Loading…
Reference in New Issue
Block a user