From 2ff2d288410cc3ec63ab0d021469edff6874757e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 4 Feb 2010 05:11:02 +0000 Subject: [PATCH] BUGFIX: More fixes renaming SSReport to SS_Report git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@98218 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 2 +- code/Report.php | 28 ++++++++++++------------- code/ReportAdmin.php | 8 ++++---- code/SideReport.php | 33 ++++++------------------------ code/reports/BrokenLinksReport.php | 2 +- 5 files changed, 26 insertions(+), 47 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index 0b5ed4e0..4f620ad3 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -662,7 +662,7 @@ JS; } function SideReports() { - return SSReport::get_reports('SideReport'); + return SS_Report::get_reports('SideReport'); } /* diff --git a/code/Report.php b/code/Report.php index 3fab8221..2491dfe9 100644 --- a/code/Report.php +++ b/code/Report.php @@ -35,7 +35,7 @@ * Showing reports to the user * =========================== * - * Right now, all subclasses of SSReport will be shown in the ReportAdmin. However, we are planning + * Right now, all subclasses of SS_Report will be shown in the ReportAdmin. However, we are planning * on adding an explicit registration mechanism, so that you can decide which reports go in the * report admin, and which go elsewhere (such as the side panel in the CMS). * @@ -44,7 +44,7 @@ */ class SS_Report extends ViewableData { /** - * Report registry populated by {@link SSReport::register()} + * Report registry populated by {@link SS_Report::register()} */ private static $registered_reports = array(); @@ -107,7 +107,7 @@ class SS_Report extends ViewableData { */ function sourceQuery($params) { if($this->hasMethod('sourceRecords')) { - $query = new SSReport_FakeQuery($this, 'sourceRecords', $params); + $query = new SS_Report_FakeQuery($this, 'sourceRecords', $params); $query->setSortColumnMethod('sortColumns'); return $query; } else { @@ -163,7 +163,7 @@ class SS_Report extends ViewableData { * data objects. * * @uses getReportField() to render a table, or similar field for the report. This - * method should be defined on the SSReport subclasses. + * method should be defined on the SS_Report subclasses. * * @return FieldSet */ @@ -296,8 +296,8 @@ class SS_Report extends ViewableData { * The default value is zero. */ static function register($list, $reportClass, $priority = 0) { - if(strpos($reportClass, '(') === false && (!class_exists($reportClass) || !is_subclass_of($reportClass,'SSReport'))) { - user_error("SSReport::register(): '$reportClass' is not a subclass of SSReport", E_USER_WARNING); + if(strpos($reportClass, '(') === false && (!class_exists($reportClass) || !is_subclass_of($reportClass,'SS_Report'))) { + user_error("SS_Report::register(): '$reportClass' is not a subclass of SS_Report", E_USER_WARNING); return; } @@ -312,8 +312,8 @@ class SS_Report extends ViewableData { } /** - * Return the SSReport objects making up the given list. - * @return An array of SSReport objects + * Return the SS_Report objects making up the given list. + * @return An array of SS_Report objects */ static function get_reports($list) { $output = array(); @@ -349,17 +349,17 @@ class SS_Report extends ViewableData { * Use it like this: * * function sourceQuery($params) { - * return new SSReport_FakeQuery($this, 'sourceRecords', $params) + * return new SS_Report_FakeQuery($this, 'sourceRecords', $params) * } * function sourceRecords($params, $sort, $limit) { * // Do some stuff * // Return a DataObjectSet of actual objects. * } * - * This object is used by the default implementation of sourceQuery() on SSReport, to make use of + * This object is used by the default implementation of sourceQuery() on SS_Report, to make use of * a sourceReords() method if one exists. */ -class SSReport_FakeQuery extends SQLQuery { +class SS_Report_FakeQuery extends SQLQuery { public $orderby; public $limit; @@ -410,20 +410,20 @@ class SSReport_FakeQuery extends SQLQuery { } /** - * SSReportWrapper is a base class for creating report wappers. + * SS_ReportWrapper is a base class for creating report wappers. * * Wrappers encapsulate an existing report to alter their behaviour - they are implementations of * the standard GoF decorator pattern. * * This base class ensure that, by default, wrappers behave in the same way as the report that is * being wrapped. You should override any methods that need to behave differently in your subclass - * of SSReportWrapper. + * of SS_ReportWrapper. * * It also makes calls to 2 empty methods that you can override {@link beforeQuery()} and * {@link afterQuery()} */ -abstract class SSReportWrapper extends SSReport { +abstract class SS_ReportWrapper extends SS_Report { protected $baseReport; function __construct($baseReport) { diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index 1b1be86b..e1ab28c5 100755 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -67,7 +67,7 @@ class ReportAdmin extends LeftAndMain { */ public function Reports() { $output = new DataObjectSet(); - foreach(SSReport::get_reports('ReportAdmin') as $report) { + foreach(SS_Report::get_reports('ReportAdmin') as $report) { if($report->canView()) $output->push($report); } return $output; @@ -129,7 +129,7 @@ class ReportAdmin extends LeftAndMain { /** * Get the current report * - * @return SSReport + * @return SS_Report */ public function CurrentReport() { $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentReport'); @@ -158,7 +158,7 @@ class ReportAdmin extends LeftAndMain { $fields = new FieldSet(); $actions = new FieldSet(); - $reports = SSReport::get_reports('ReportAdmin'); + $reports = SS_Report::get_reports('ReportAdmin'); $obj = $reports[$id]; if($obj) $fields = $obj->getCMSFields(); @@ -198,7 +198,7 @@ class ReportAdmin extends LeftAndMain { * @return boolean */ public static function has_reports() { - return sizeof(SSReport::get_reports('ReportAdmin')) > 0; + return sizeof(SS_Report::get_reports('ReportAdmin')) > 0; } public function updatereport() { diff --git a/code/SideReport.php b/code/SideReport.php index 5acb22d5..192108f4 100755 --- a/code/SideReport.php +++ b/code/SideReport.php @@ -98,7 +98,7 @@ class SideReportView extends ViewableData { * * This report wrapper will use sideReportColumns() for the report columns, instead of columns(). */ -class SideReportWrapper extends SSReportWrapper { +class SideReportWrapper extends SS_ReportWrapper { function columns() { if($this->baseReport->hasMethod('sideReportColumns')) { return $this->baseReport->sideReportColumns(); @@ -168,7 +168,7 @@ class SideReport_RecentlyEdited extends SS_Report { } } -class SideReport_ToDo extends SideReport { +class SideReport_ToDo extends SS_Report { function title() { return _t('SideReport.TODO',"Pages with To Do items"); } @@ -178,17 +178,17 @@ class SideReport_ToDo extends SideReport { function sort() { return 0; } - function records($params = null) { + function sourceRecords($params = null) { return DataObject::get("SiteTree", "\"SiteTree\".\"ToDo\" IS NOT NULL AND \"SiteTree\".\"ToDo\" <> ''", "\"SiteTree\".\"LastEdited\" DESC"); } - function fieldsToShow() { + function columns() { return array( "Title" => array( - "source" => array("NestedTitle", array("2")), + "title" => "Title", // todo: use NestedTitle(2) "link" => true, ), "ToDo" => array( - "source" => "ToDo", + "title" => "ToDo", "newline" => true, ), ); @@ -326,24 +326,3 @@ class SideReport_BrokenRedirectorPages extends SS_Report { ); } } - -class SideReport_ToDo extends SS_Report { - function title() { - return _t('SideReport.TODO',"To do"); - } - function sourceRecords($params = null) { - return DataObject::get("SiteTree", "\"SiteTree\".\"ToDo\" IS NOT NULL AND \"SiteTree\".\"ToDo\" <> ''", "\"SiteTree\".\"LastEdited\" DESC"); - } - function columns() { - return array( - "Title" => array( - "title" => "Title", // todo: use NestedTitle(2) - "link" => true, - ), - "ToDo" => array( - "title" => "ToDo", - "newline" => true, - ), - ); - } -} diff --git a/code/reports/BrokenLinksReport.php b/code/reports/BrokenLinksReport.php index 2f7f8a64..f72a5265 100644 --- a/code/reports/BrokenLinksReport.php +++ b/code/reports/BrokenLinksReport.php @@ -6,7 +6,7 @@ * @subpackage content */ -class BrokenLinksReport extends SSReport { +class BrokenLinksReport extends SS_Report { function title() { return _t('BrokenLinksReport.BROKENLINKS',"Broken links report"); }