From cc89bc68e9f9d910a69940109787c878aa9bb35b Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 4 Feb 2010 04:51:32 +0000 Subject: [PATCH] BUGFIX: Don't throw an error if there are no report filters. ENHANCEMENT: Allow for custom generation of SSReport::ID() for parameterised reports. MINOR: Added SSReport::dataClass() accessor. BUGFIX: Don't randomise the order of reports with the same priority. (from r95955) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@98180 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ReportAdmin.php | 11 +++++------ templates/ReportAdminForm.ss | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index 0084e37e..ce6a24c9 100755 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -92,7 +92,7 @@ class ReportAdmin extends LeftAndMain { * @return unknown */ protected function showWithEditForm($params, $editForm) { - if(isset($params['ID'])) Session::set('currentPage', $params['ID']); + if(isset($params['ID'])) Session::set('currentReport', $params['ID']); if(isset($params['OtherID'])) Session::set('currentOtherID', $params['OtherID']); if(Director::is_ajax()) { @@ -116,7 +116,7 @@ class ReportAdmin extends LeftAndMain { * @return Form */ public function EditForm() { - $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentPage'); + $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentReport'); if($id) { foreach($this->Reports() as $report) { @@ -142,10 +142,9 @@ class ReportAdmin extends LeftAndMain { $fields = new FieldSet(); $actions = new FieldSet(); - if(is_numeric($id)) $page = DataObject::get_by_id('SiteTree', $id); - $reportClass = is_object($page) ? 'SS_Report_' . $page->ClassName : $id; - - $obj = new $reportClass(); + $reports = SSReport::get_reports('ReportAdmin'); + $obj = $reports[$id]; + if($obj) $fields = $obj->getCMSFields(); if($obj) $actions = $obj->getCMSActions(); diff --git a/templates/ReportAdminForm.ss b/templates/ReportAdminForm.ss index f342bb0f..41e208e8 100644 --- a/templates/ReportAdminForm.ss +++ b/templates/ReportAdminForm.ss @@ -11,6 +11,7 @@ + <% if FieldMap.Filters.Children %>
Filter by
<% control FieldMap.Filters %> @@ -24,10 +25,13 @@

+ <% if FieldMap.action_updatereport %> $FieldMap.action_updatereport.Field + <% end_if %>
 
+ <% end_if %> $FieldMap.ReportContent.FieldHolder