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
This commit is contained in:
Sam Minnee 2010-02-04 05:11:02 +00:00
parent 983849449e
commit 2ff2d28841
5 changed files with 26 additions and 47 deletions

View File

@ -662,7 +662,7 @@ JS;
} }
function SideReports() { function SideReports() {
return SSReport::get_reports('SideReport'); return SS_Report::get_reports('SideReport');
} }
/* /*

View File

@ -35,7 +35,7 @@
* Showing reports to the user * 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 * 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). * report admin, and which go elsewhere (such as the side panel in the CMS).
* *
@ -44,7 +44,7 @@
*/ */
class SS_Report extends ViewableData { 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(); private static $registered_reports = array();
@ -107,7 +107,7 @@ class SS_Report extends ViewableData {
*/ */
function sourceQuery($params) { function sourceQuery($params) {
if($this->hasMethod('sourceRecords')) { if($this->hasMethod('sourceRecords')) {
$query = new SSReport_FakeQuery($this, 'sourceRecords', $params); $query = new SS_Report_FakeQuery($this, 'sourceRecords', $params);
$query->setSortColumnMethod('sortColumns'); $query->setSortColumnMethod('sortColumns');
return $query; return $query;
} else { } else {
@ -163,7 +163,7 @@ class SS_Report extends ViewableData {
* data objects. * data objects.
* *
* @uses getReportField() to render a table, or similar field for the report. This * @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 * @return FieldSet
*/ */
@ -296,8 +296,8 @@ class SS_Report extends ViewableData {
* The default value is zero. * The default value is zero.
*/ */
static function register($list, $reportClass, $priority = 0) { static function register($list, $reportClass, $priority = 0) {
if(strpos($reportClass, '(') === false && (!class_exists($reportClass) || !is_subclass_of($reportClass,'SSReport'))) { if(strpos($reportClass, '(') === false && (!class_exists($reportClass) || !is_subclass_of($reportClass,'SS_Report'))) {
user_error("SSReport::register(): '$reportClass' is not a subclass of SSReport", E_USER_WARNING); user_error("SS_Report::register(): '$reportClass' is not a subclass of SS_Report", E_USER_WARNING);
return; return;
} }
@ -312,8 +312,8 @@ class SS_Report extends ViewableData {
} }
/** /**
* Return the SSReport objects making up the given list. * Return the SS_Report objects making up the given list.
* @return An array of SSReport objects * @return An array of SS_Report objects
*/ */
static function get_reports($list) { static function get_reports($list) {
$output = array(); $output = array();
@ -349,17 +349,17 @@ class SS_Report extends ViewableData {
* Use it like this: * Use it like this:
* *
* function sourceQuery($params) { * function sourceQuery($params) {
* return new SSReport_FakeQuery($this, 'sourceRecords', $params) * return new SS_Report_FakeQuery($this, 'sourceRecords', $params)
* } * }
* function sourceRecords($params, $sort, $limit) { * function sourceRecords($params, $sort, $limit) {
* // Do some stuff * // Do some stuff
* // Return a DataObjectSet of actual objects. * // 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. * a sourceReords() method if one exists.
*/ */
class SSReport_FakeQuery extends SQLQuery { class SS_Report_FakeQuery extends SQLQuery {
public $orderby; public $orderby;
public $limit; 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 * Wrappers encapsulate an existing report to alter their behaviour - they are implementations of
* the standard GoF decorator pattern. * the standard GoF decorator pattern.
* *
* This base class ensure that, by default, wrappers behave in the same way as the report that is * 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 * 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 * It also makes calls to 2 empty methods that you can override {@link beforeQuery()} and
* {@link afterQuery()} * {@link afterQuery()}
*/ */
abstract class SSReportWrapper extends SSReport { abstract class SS_ReportWrapper extends SS_Report {
protected $baseReport; protected $baseReport;
function __construct($baseReport) { function __construct($baseReport) {

View File

@ -67,7 +67,7 @@ class ReportAdmin extends LeftAndMain {
*/ */
public function Reports() { public function Reports() {
$output = new DataObjectSet(); $output = new DataObjectSet();
foreach(SSReport::get_reports('ReportAdmin') as $report) { foreach(SS_Report::get_reports('ReportAdmin') as $report) {
if($report->canView()) $output->push($report); if($report->canView()) $output->push($report);
} }
return $output; return $output;
@ -129,7 +129,7 @@ class ReportAdmin extends LeftAndMain {
/** /**
* Get the current report * Get the current report
* *
* @return SSReport * @return SS_Report
*/ */
public function CurrentReport() { public function CurrentReport() {
$id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentReport'); $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentReport');
@ -158,7 +158,7 @@ class ReportAdmin extends LeftAndMain {
$fields = new FieldSet(); $fields = new FieldSet();
$actions = new FieldSet(); $actions = new FieldSet();
$reports = SSReport::get_reports('ReportAdmin'); $reports = SS_Report::get_reports('ReportAdmin');
$obj = $reports[$id]; $obj = $reports[$id];
if($obj) $fields = $obj->getCMSFields(); if($obj) $fields = $obj->getCMSFields();
@ -198,7 +198,7 @@ class ReportAdmin extends LeftAndMain {
* @return boolean * @return boolean
*/ */
public static function has_reports() { public static function has_reports() {
return sizeof(SSReport::get_reports('ReportAdmin')) > 0; return sizeof(SS_Report::get_reports('ReportAdmin')) > 0;
} }
public function updatereport() { public function updatereport() {

View File

@ -98,7 +98,7 @@ class SideReportView extends ViewableData {
* *
* This report wrapper will use sideReportColumns() for the report columns, instead of columns(). * This report wrapper will use sideReportColumns() for the report columns, instead of columns().
*/ */
class SideReportWrapper extends SSReportWrapper { class SideReportWrapper extends SS_ReportWrapper {
function columns() { function columns() {
if($this->baseReport->hasMethod('sideReportColumns')) { if($this->baseReport->hasMethod('sideReportColumns')) {
return $this->baseReport->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() { function title() {
return _t('SideReport.TODO',"Pages with To Do items"); return _t('SideReport.TODO',"Pages with To Do items");
} }
@ -178,17 +178,17 @@ class SideReport_ToDo extends SideReport {
function sort() { function sort() {
return 0; 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"); return DataObject::get("SiteTree", "\"SiteTree\".\"ToDo\" IS NOT NULL AND \"SiteTree\".\"ToDo\" <> ''", "\"SiteTree\".\"LastEdited\" DESC");
} }
function fieldsToShow() { function columns() {
return array( return array(
"Title" => array( "Title" => array(
"source" => array("NestedTitle", array("2")), "title" => "Title", // todo: use NestedTitle(2)
"link" => true, "link" => true,
), ),
"ToDo" => array( "ToDo" => array(
"source" => "ToDo", "title" => "ToDo",
"newline" => true, "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,
),
);
}
}

View File

@ -6,7 +6,7 @@
* @subpackage content * @subpackage content
*/ */
class BrokenLinksReport extends SSReport { class BrokenLinksReport extends SS_Report {
function title() { function title() {
return _t('BrokenLinksReport.BROKENLINKS',"Broken links report"); return _t('BrokenLinksReport.BROKENLINKS',"Broken links report");
} }