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:
Sam Minnee 2009-10-26 03:06:42 +00:00
parent b2eb234669
commit f71804e465
8 changed files with 31 additions and 31 deletions

View File

@ -1208,10 +1208,10 @@ JS;
return FormResponse::respond(); return FormResponse::respond();
} else { } else {
return new HTTPResponse("SiteTree #$id not found", 400); return new SS_HTTPResponse("SiteTree #$id not found", 400);
} }
} else { } 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);
} }
} }

View File

@ -332,7 +332,7 @@ class ModelAdmin_CollectionController extends Controller {
* Delegate to the RecordController if a valid numeric ID appears in the URL * Delegate to the RecordController if a valid numeric ID appears in the URL
* segment. * segment.
* *
* @param HTTPRequest $request * @param SS_HTTPRequest $request
* @return RecordController * @return RecordController
*/ */
public function handleID($request) { public function handleID($request) {
@ -480,7 +480,7 @@ class ModelAdmin_CollectionController extends Controller {
* *
* @param array $data * @param array $data
* @param Form $form * @param Form $form
* @param HTTPRequest $request * @param SS_HTTPRequest $request
*/ */
function import($data, $form, $request) { function import($data, $form, $request) {
$modelName = $data['ClassName']; $modelName = $data['ClassName'];
@ -610,7 +610,7 @@ class ModelAdmin_CollectionController extends Controller {
$numResults = $tableField->TotalCount(); $numResults = $tableField->TotalCount();
if($numResults) { if($numResults) {
return new HTTPResponse( return new SS_HTTPResponse(
$resultsForm->forTemplate(), $resultsForm->forTemplate(),
200, 200,
sprintf( sprintf(
@ -619,7 +619,7 @@ class ModelAdmin_CollectionController extends Controller {
) )
); );
} else { } else {
return new HTTPResponse( return new SS_HTTPResponse(
$resultsForm->forTemplate(), $resultsForm->forTemplate(),
200, 200,
_t('ModelAdmin.NORESULTS',"Your search didn't return any matching items") _t('ModelAdmin.NORESULTS',"Your search didn't return any matching items")
@ -710,7 +710,7 @@ class ModelAdmin_CollectionController extends Controller {
*/ */
function ResultsForm($searchCriteria) { function ResultsForm($searchCriteria) {
if($searchCriteria instanceof HTTPRequest) $searchCriteria = $searchCriteria->getVars(); if($searchCriteria instanceof SS_HTTPRequest) $searchCriteria = $searchCriteria->getVars();
$tf = $this->getResultsTable($searchCriteria); $tf = $this->getResultsTable($searchCriteria);
@ -749,7 +749,7 @@ class ModelAdmin_CollectionController extends Controller {
* @return unknown * @return unknown
*/ */
function add($request) { function add($request) {
return new HTTPResponse( return new SS_HTTPResponse(
$this->AddForm()->forAjaxTemplate(), $this->AddForm()->forAjaxTemplate(),
200, 200,
sprintf( sprintf(
@ -816,7 +816,7 @@ class ModelAdmin_CollectionController extends Controller {
if(Director::is_ajax()) { if(Director::is_ajax()) {
$recordController = new ModelAdmin_RecordController($this, $request, $model->ID); $recordController = new ModelAdmin_RecordController($this, $request, $model->ID);
return new HTTPResponse( return new SS_HTTPResponse(
$recordController->EditForm()->forAjaxTemplate(), $recordController->EditForm()->forAjaxTemplate(),
200, 200,
sprintf( sprintf(
@ -867,7 +867,7 @@ class ModelAdmin_RecordController extends Controller {
function edit($request) { function edit($request) {
if ($this->currentRecord) { if ($this->currentRecord) {
if(Director::is_ajax()) { if(Director::is_ajax()) {
return new HTTPResponse( return new SS_HTTPResponse(
$this->EditForm()->forAjaxTemplate(), $this->EditForm()->forAjaxTemplate(),
200, 200,
sprintf( sprintf(
@ -924,7 +924,7 @@ class ModelAdmin_RecordController extends Controller {
* *
* @param array $data * @param array $data
* @param Form $form * @param Form $form
* @param HTTPRequest $request * @param SS_HTTPRequest $request
* @return mixed * @return mixed
*/ */
function doSave($data, $form, $request) { function doSave($data, $form, $request) {
@ -962,7 +962,7 @@ class ModelAdmin_RecordController extends Controller {
/** /**
* Renders the record view template. * Renders the record view template.
* *
* @param HTTPRequest $request * @param SS_HTTPRequest $request
* @return mixed * @return mixed
*/ */
function view($request) { function view($request) {

View File

@ -4,12 +4,12 @@
* viewable in the Reports top menu section of CMS. * viewable in the Reports top menu section of CMS.
* *
* To include your own report into the ReportAdmin * 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: * overload these:
* *
* @link SSReport::$title * @link SS_Report::$title
* @link SSReport::$description * @link SS_Report::$description
* @link SSReport->getReportField() * @link SS_Report->getReportField()
* *
* getReportField() should return a FormField instance, * getReportField() should return a FormField instance,
* such as a ComplexTableField, or TableListField. This * such as a ComplexTableField, or TableListField. This
@ -20,13 +20,13 @@
* a TableListField listing orders that have the property * a TableListField listing orders that have the property
* "Unprinted = 1". * "Unprinted = 1".
* *
* @see ReportAdmin for where SSReport instances are * @see ReportAdmin for where SS_Report instances are
* used in the CMS. * used in the CMS.
* *
* @package cms * @package cms
* @subpackage reports * @subpackage reports
*/ */
class SSReport extends ViewableData { class SS_Report extends ViewableData {
/** /**
* This is the title of the report, * This is the title of the report,
@ -51,7 +51,7 @@ class SSReport 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
*/ */

View File

@ -3,10 +3,10 @@
* Reports section of the CMS. * Reports section of the CMS.
* *
* All reports that should show in the ReportAdmin section * 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. * the appropriate methods and variables that are required.
* *
* @see SSReport * @see SS_Report
* *
* @package cms * @package cms
* @subpackage reports * @subpackage reports
@ -47,7 +47,7 @@ class ReportAdmin extends LeftAndMain {
*/ */
public function getReportClassNames() { public function getReportClassNames() {
$baseClass = 'SSReport'; $baseClass = 'SS_Report';
$response = array(); $response = array();
// get all sub-classnames (incl. base classname). // 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. * that are available for use.
* *
* @return DataObjectSet * @return DataObjectSet
@ -121,7 +121,7 @@ class ReportAdmin extends LeftAndMain {
/** /**
* Show a report based on the URL query string. * 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) { public function show($request) {
$params = $request->allParams(); $params = $request->allParams();
@ -193,7 +193,7 @@ class ReportAdmin extends LeftAndMain {
$actions = new FieldSet(); $actions = new FieldSet();
if(is_numeric($id)) $page = DataObject::get_by_id('SiteTree', $id); 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(); $obj = new $reportClass();
if($obj) $fields = $obj->getCMSFields(); if($obj) $fields = $obj->getCMSFields();
@ -214,7 +214,7 @@ class ReportAdmin extends LeftAndMain {
* *
* The test for an existance of a report * The test for an existance of a report
* is done by checking for a subclass of * is done by checking for a subclass of
* "SSReport" that exists. * "SS_Report" that exists.
* *
* @return boolean * @return boolean
*/ */

View File

@ -107,7 +107,7 @@ class SideReport_RecentlyEdited extends SideReport {
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks"); return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
} }
function records($params = null) { 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"); return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
} }
function fieldsToShow() { function fieldsToShow() {

View File

@ -92,7 +92,7 @@ class StaticExporter extends Controller {
Filesystem::removeFolder($tmpBaseFolder); Filesystem::removeFolder($tmpBaseFolder);
// return as download to the client // 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(); echo $response->output();
} }

View File

@ -30,7 +30,7 @@ class LeftAndMainTest extends FunctionalTest {
$response = $this->get($link); $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"); $this->assertEquals(200, $response->getStatusCode(), "$link should return 200 status code");
// Check that a HTML page has been returned // Check that a HTML page has been returned
$this->assertRegExp('/<html[^>]*>/i', $response->getBody(), "$link should contain <html> tag"); $this->assertRegExp('/<html[^>]*>/i', $response->getBody(), "$link should contain <html> tag");

4
tests/SideReportTest.php Normal file → Executable file
View File

@ -23,7 +23,7 @@ class SideReportTest extends SapphireTest {
} }
function testRecentlyEdited() { 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'); $after = $this->objFromFixture('SiteTree', 'after');
$before = $this->objFromFixture('SiteTree', 'before'); $before = $this->objFromFixture('SiteTree', 'before');
@ -35,6 +35,6 @@ class SideReportTest extends SapphireTest {
$this->assertContains($after->ID, $r->records()->column('ID')); $this->assertContains($after->ID, $r->records()->column('ID'));
$this->assertNotContains($before->ID, $r->records()->column('ID')); $this->assertNotContains($before->ID, $r->records()->column('ID'));
SSDateTime::clear_mock_now(); SS_DateTime::clear_mock_now();
} }
} }