mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
API CHANGE: Renamed conflicting classes to have an "SS_" namespace, and renamed existing "SS" namespace to "SS_". The affected classes are: HTTPRequest, HTTPResponse, Query, Database, SSBacktrace, SSCli, SSDatetime, SSDatetimeTest, SSLog, SSLogTest, SSLogEmailWriter, SSLogErrorEmailFormatter, SSLogErrorFileFormatter, SSLogFileWriter and SSZendLog.
MINOR: Replaced usage of renamed classes with the new namespaced name. From: Sam Minnee <sam@silverstripe.com> git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90076 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b2eb234669
commit
f71804e465
@ -1208,10 +1208,10 @@ JS;
|
||||
return FormResponse::respond();
|
||||
|
||||
} else {
|
||||
return new HTTPResponse("SiteTree #$id not found", 400);
|
||||
return new SS_HTTPResponse("SiteTree #$id not found", 400);
|
||||
}
|
||||
} else {
|
||||
return new HTTPResponse("Please pass an ID in the form content", 400);
|
||||
return new SS_HTTPResponse("Please pass an ID in the form content", 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
* Delegate to the RecordController if a valid numeric ID appears in the URL
|
||||
* segment.
|
||||
*
|
||||
* @param HTTPRequest $request
|
||||
* @param SS_HTTPRequest $request
|
||||
* @return RecordController
|
||||
*/
|
||||
public function handleID($request) {
|
||||
@ -480,7 +480,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
*
|
||||
* @param array $data
|
||||
* @param Form $form
|
||||
* @param HTTPRequest $request
|
||||
* @param SS_HTTPRequest $request
|
||||
*/
|
||||
function import($data, $form, $request) {
|
||||
$modelName = $data['ClassName'];
|
||||
@ -610,7 +610,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
$numResults = $tableField->TotalCount();
|
||||
|
||||
if($numResults) {
|
||||
return new HTTPResponse(
|
||||
return new SS_HTTPResponse(
|
||||
$resultsForm->forTemplate(),
|
||||
200,
|
||||
sprintf(
|
||||
@ -619,7 +619,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return new HTTPResponse(
|
||||
return new SS_HTTPResponse(
|
||||
$resultsForm->forTemplate(),
|
||||
200,
|
||||
_t('ModelAdmin.NORESULTS',"Your search didn't return any matching items")
|
||||
@ -710,7 +710,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
*/
|
||||
function ResultsForm($searchCriteria) {
|
||||
|
||||
if($searchCriteria instanceof HTTPRequest) $searchCriteria = $searchCriteria->getVars();
|
||||
if($searchCriteria instanceof SS_HTTPRequest) $searchCriteria = $searchCriteria->getVars();
|
||||
|
||||
$tf = $this->getResultsTable($searchCriteria);
|
||||
|
||||
@ -749,7 +749,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
* @return unknown
|
||||
*/
|
||||
function add($request) {
|
||||
return new HTTPResponse(
|
||||
return new SS_HTTPResponse(
|
||||
$this->AddForm()->forAjaxTemplate(),
|
||||
200,
|
||||
sprintf(
|
||||
@ -816,7 +816,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
|
||||
if(Director::is_ajax()) {
|
||||
$recordController = new ModelAdmin_RecordController($this, $request, $model->ID);
|
||||
return new HTTPResponse(
|
||||
return new SS_HTTPResponse(
|
||||
$recordController->EditForm()->forAjaxTemplate(),
|
||||
200,
|
||||
sprintf(
|
||||
@ -867,7 +867,7 @@ class ModelAdmin_RecordController extends Controller {
|
||||
function edit($request) {
|
||||
if ($this->currentRecord) {
|
||||
if(Director::is_ajax()) {
|
||||
return new HTTPResponse(
|
||||
return new SS_HTTPResponse(
|
||||
$this->EditForm()->forAjaxTemplate(),
|
||||
200,
|
||||
sprintf(
|
||||
@ -924,7 +924,7 @@ class ModelAdmin_RecordController extends Controller {
|
||||
*
|
||||
* @param array $data
|
||||
* @param Form $form
|
||||
* @param HTTPRequest $request
|
||||
* @param SS_HTTPRequest $request
|
||||
* @return mixed
|
||||
*/
|
||||
function doSave($data, $form, $request) {
|
||||
@ -962,7 +962,7 @@ class ModelAdmin_RecordController extends Controller {
|
||||
/**
|
||||
* Renders the record view template.
|
||||
*
|
||||
* @param HTTPRequest $request
|
||||
* @param SS_HTTPRequest $request
|
||||
* @return mixed
|
||||
*/
|
||||
function view($request) {
|
||||
|
@ -4,12 +4,12 @@
|
||||
* viewable in the Reports top menu section of CMS.
|
||||
*
|
||||
* To include your own report into the ReportAdmin
|
||||
* of the CMS, your subclass of SSReport should
|
||||
* of the CMS, your subclass of SS_Report should
|
||||
* overload these:
|
||||
*
|
||||
* @link SSReport::$title
|
||||
* @link SSReport::$description
|
||||
* @link SSReport->getReportField()
|
||||
* @link SS_Report::$title
|
||||
* @link SS_Report::$description
|
||||
* @link SS_Report->getReportField()
|
||||
*
|
||||
* getReportField() should return a FormField instance,
|
||||
* such as a ComplexTableField, or TableListField. This
|
||||
@ -20,13 +20,13 @@
|
||||
* a TableListField listing orders that have the property
|
||||
* "Unprinted = 1".
|
||||
*
|
||||
* @see ReportAdmin for where SSReport instances are
|
||||
* @see ReportAdmin for where SS_Report instances are
|
||||
* used in the CMS.
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage reports
|
||||
*/
|
||||
class SSReport extends ViewableData {
|
||||
class SS_Report extends ViewableData {
|
||||
|
||||
/**
|
||||
* This is the title of the report,
|
||||
@ -51,7 +51,7 @@ class SSReport 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
|
||||
*/
|
@ -3,10 +3,10 @@
|
||||
* Reports section of the CMS.
|
||||
*
|
||||
* All reports that should show in the ReportAdmin section
|
||||
* of the CMS need to subclass {@link SSReport}, and implement
|
||||
* of the CMS need to subclass {@link SS_Report}, and implement
|
||||
* the appropriate methods and variables that are required.
|
||||
*
|
||||
* @see SSReport
|
||||
* @see SS_Report
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage reports
|
||||
@ -47,7 +47,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
*/
|
||||
public function getReportClassNames() {
|
||||
|
||||
$baseClass = 'SSReport';
|
||||
$baseClass = 'SS_Report';
|
||||
$response = array();
|
||||
|
||||
// get all sub-classnames (incl. base classname).
|
||||
@ -98,7 +98,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a DataObjectSet of SSReport subclasses
|
||||
* Return a DataObjectSet of SS_Report subclasses
|
||||
* that are available for use.
|
||||
*
|
||||
* @return DataObjectSet
|
||||
@ -121,7 +121,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
/**
|
||||
* Show a report based on the URL query string.
|
||||
*
|
||||
* @param HTTPRequest $request The HTTP request object
|
||||
* @param SS_HTTPRequest $request The HTTP request object
|
||||
*/
|
||||
public function show($request) {
|
||||
$params = $request->allParams();
|
||||
@ -193,7 +193,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
$actions = new FieldSet();
|
||||
|
||||
if(is_numeric($id)) $page = DataObject::get_by_id('SiteTree', $id);
|
||||
$reportClass = is_object($page) ? 'SSReport_' . $page->ClassName : $id;
|
||||
$reportClass = is_object($page) ? 'SS_Report_' . $page->ClassName : $id;
|
||||
|
||||
$obj = new $reportClass();
|
||||
if($obj) $fields = $obj->getCMSFields();
|
||||
@ -214,7 +214,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
*
|
||||
* The test for an existance of a report
|
||||
* is done by checking for a subclass of
|
||||
* "SSReport" that exists.
|
||||
* "SS_Report" that exists.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@ class SideReport_RecentlyEdited extends SideReport {
|
||||
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
||||
}
|
||||
function records($params = null) {
|
||||
$threshold = strtotime('-14 days', SSDatetime::now()->Format('U'));
|
||||
$threshold = strtotime('-14 days', SS_Datetime::now()->Format('U'));
|
||||
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
|
||||
}
|
||||
function fieldsToShow() {
|
||||
|
@ -92,7 +92,7 @@ class StaticExporter extends Controller {
|
||||
Filesystem::removeFolder($tmpBaseFolder);
|
||||
|
||||
// return as download to the client
|
||||
$response = HTTPRequest::send_file($archiveContent, "$baseFolderName.tar.gz", 'application/x-tar-gz');
|
||||
$response = SS_HTTPRequest::send_file($archiveContent, "$baseFolderName.tar.gz", 'application/x-tar-gz');
|
||||
echo $response->output();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
|
||||
$response = $this->get($link);
|
||||
|
||||
$this->assertType('HTTPResponse', $response, "$link should return a response object");
|
||||
$this->assertType('SS_HTTPResponse', $response, "$link should return a response object");
|
||||
$this->assertEquals(200, $response->getStatusCode(), "$link should return 200 status code");
|
||||
// Check that a HTML page has been returned
|
||||
$this->assertRegExp('/<html[^>]*>/i', $response->getBody(), "$link should contain <html> tag");
|
||||
|
4
tests/SideReportTest.php
Normal file → Executable file
4
tests/SideReportTest.php
Normal file → Executable file
@ -23,7 +23,7 @@ class SideReportTest extends SapphireTest {
|
||||
}
|
||||
|
||||
function testRecentlyEdited() {
|
||||
SSDateTime::set_mock_now('31-06-2009 00:00:00');
|
||||
SS_Datetime::set_mock_now('31-06-2009 00:00:00');
|
||||
|
||||
$after = $this->objFromFixture('SiteTree', 'after');
|
||||
$before = $this->objFromFixture('SiteTree', 'before');
|
||||
@ -35,6 +35,6 @@ class SideReportTest extends SapphireTest {
|
||||
$this->assertContains($after->ID, $r->records()->column('ID'));
|
||||
$this->assertNotContains($before->ID, $r->records()->column('ID'));
|
||||
|
||||
SSDateTime::clear_mock_now();
|
||||
SS_DateTime::clear_mock_now();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user