diff --git a/_config.php b/_config.php index 0943fd88..eec9e6af 100644 --- a/_config.php +++ b/_config.php @@ -1,6 +1,9 @@ admin/pages' diff --git a/code/BatchActions/CMSBatchAction_Archive.php b/code/BatchActions/CMSBatchAction_Archive.php index a9a5a6f1..4664c7f7 100644 --- a/code/BatchActions/CMSBatchAction_Archive.php +++ b/code/BatchActions/CMSBatchAction_Archive.php @@ -7,9 +7,6 @@ use SilverStripe\ORM\SS_List; /** * Archives a page, removing it from both live and stage - * - * @package cms - * @subpackage batchaction */ class CMSBatchAction_Archive extends CMSBatchAction { diff --git a/code/BatchActions/CMSBatchAction_Delete.php b/code/BatchActions/CMSBatchAction_Delete.php index ac70fb4a..b959f157 100644 --- a/code/BatchActions/CMSBatchAction_Delete.php +++ b/code/BatchActions/CMSBatchAction_Delete.php @@ -8,9 +8,6 @@ use SilverStripe\Admin\CMSBatchAction; /** * Delete items batch action. - * - * @package cms - * @subpackage batchaction */ class CMSBatchAction_Delete extends CMSBatchAction { public function getActionTitle() { diff --git a/code/BatchActions/CMSBatchAction_Publish.php b/code/BatchActions/CMSBatchAction_Publish.php index 1912b13f..a7ea593d 100644 --- a/code/BatchActions/CMSBatchAction_Publish.php +++ b/code/BatchActions/CMSBatchAction_Publish.php @@ -7,9 +7,6 @@ use SilverStripe\ORM\SS_List; /** * Publish items batch action. - * - * @package cms - * @subpackage batchaction */ class CMSBatchAction_Publish extends CMSBatchAction { diff --git a/code/BatchActions/CMSBatchAction_Restore.php b/code/BatchActions/CMSBatchAction_Restore.php index d69b78e2..1644e6e4 100644 --- a/code/BatchActions/CMSBatchAction_Restore.php +++ b/code/BatchActions/CMSBatchAction_Restore.php @@ -11,8 +11,6 @@ use SilverStripe\Security\Permission; /** * Batch restore of pages - * @package cms - * @subpackage batchaction */ class CMSBatchAction_Restore extends CMSBatchAction { diff --git a/code/BatchActions/CMSBatchAction_Unpublish.php b/code/BatchActions/CMSBatchAction_Unpublish.php index 8f4c043a..37e4f1bd 100644 --- a/code/BatchActions/CMSBatchAction_Unpublish.php +++ b/code/BatchActions/CMSBatchAction_Unpublish.php @@ -7,9 +7,6 @@ use SilverStripe\ORM\SS_List; /** * Unpublish items batch action. - * - * @package cms - * @subpackage batchaction */ class CMSBatchAction_Unpublish extends CMSBatchAction { diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index 53441e9b..667fb726 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -2,61 +2,59 @@ namespace SilverStripe\CMS\Controllers; -use FormField; -use Injector; -use ResetFormAction; -use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\Versioning\Versioned; -use SilverStripe\ORM\HiddenClass; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\DataList; -use SilverStripe\ORM\DB; -use SilverStripe\Security\Member; -use SilverStripe\Security\Security; -use SilverStripe\Security\SecurityToken; -use SilverStripe\Security\Permission; -use SilverStripe\Security\PermissionProvider; use SilverStripe\Admin\AdminRootController; -use SilverStripe\Admin\LeftAndMain; use SilverStripe\Admin\CMSBatchActionHandler; use SilverStripe\Admin\CMSPreviewable; -use SilverStripe\CMS\Model\SiteTree; -use SilverStripe\CMS\Model\RedirectorPage; +use SilverStripe\Admin\LeftAndMain; use SilverStripe\CMS\Model\CurrentPageIdentifier; -use SS_HTTPRequest; -use TabSet; +use SilverStripe\CMS\Model\RedirectorPage; +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Control\Director; +use SilverStripe\Control\Session; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Core\Convert; +use SilverStripe\Core\Injector\Injector; +use SilverStripe\Core\SS_Cache; +use SilverStripe\Forms\DateField; +use SilverStripe\Forms\DropdownField; +use SilverStripe\Forms\FieldGroup; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\Form; +use SilverStripe\Forms\FormAction; +use SilverStripe\Forms\GridField\GridField; +use SilverStripe\Forms\GridField\GridFieldConfig; +use SilverStripe\Forms\GridField\GridFieldDataColumns; +use SilverStripe\Forms\GridField\GridFieldLevelup; +use SilverStripe\Forms\GridField\GridFieldPaginator; +use SilverStripe\Forms\GridField\GridFieldSortableHeader; +use SilverStripe\Forms\HiddenField; +use SilverStripe\Forms\LabelField; +use SilverStripe\Forms\LiteralField; +use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\ResetFormAction; +use SilverStripe\Forms\TextField; +use SilverStripe\ORM\ArrayList; +use SilverStripe\ORM\DataList; +use SilverStripe\ORM\DataObject; +use SilverStripe\ORM\DB; +use SilverStripe\ORM\FieldType\DBHTMLText; +use SilverStripe\ORM\HiddenClass; +use SilverStripe\ORM\SS_List; +use SilverStripe\ORM\Versioning\Versioned; +use SilverStripe\Security\Member; +use SilverStripe\Security\Permission; +use SilverStripe\Security\PermissionProvider; +use SilverStripe\Security\Security; +use SilverStripe\Security\SecurityToken; +use SilverStripe\View\ArrayData; +use SilverStripe\View\Requirements; use Translatable; -use Requirements; -use Controller; -use Director; use Page; -use TextField; -use DateField; -use DropdownField; -use FieldGroup; -use FieldList; -use FormAction; -use Form; -use SS_Cache; use Zend_Cache; -use Convert; -use ArrayData; -use HiddenField; -use LiteralField; -use RequiredFields; -use LabelField; use InvalidArgumentException; -use GridFieldConfig; -use GridFieldSortableHeader; -use GridFieldDataColumns; -use GridFieldPaginator; -use GridFieldLevelup; -use GridField; -use SS_HTTPResponse_Exception; -use Session; -use SS_HTTPResponse; + /** * The main "content" area of the CMS. @@ -64,8 +62,6 @@ use SS_HTTPResponse; * This class creates a 2-frame layout - left-tree and right-form - to sit beneath the main * admin menu. * - * @package cms - * @subpackage controller * @todo Create some base classes to contain the generic functionality that will be replicated. * * @mixin LeftAndMainPageIconsExtension @@ -869,7 +865,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } $gridField = new GridField('Page','Pages', $list, $gridFieldConfig); /** @var GridFieldDataColumns $columns */ - $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns'); + $columns = $gridField->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns'); // Don't allow navigating into children nodes on filtered lists $fields = array( @@ -878,7 +874,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr 'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'), ); /** @var GridFieldSortableHeader $sortableHeader */ - $sortableHeader = $gridField->getConfig()->getComponentByType('GridFieldSortableHeader'); + $sortableHeader = $gridField->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldSortableHeader'); $sortableHeader->setFieldSorting(array('getTreeTitle' => 'Title')); $gridField->getState()->ParentID = $parentID; diff --git a/code/Controllers/CMSPageAddController.php b/code/Controllers/CMSPageAddController.php index 76f0413a..3bdf2863 100644 --- a/code/Controllers/CMSPageAddController.php +++ b/code/Controllers/CMSPageAddController.php @@ -2,25 +2,23 @@ namespace SilverStripe\CMS\Controllers; +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Control\Session; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\Form; +use SilverStripe\Forms\FormAction; +use SilverStripe\Forms\LiteralField; +use SilverStripe\Forms\OptionsetField; +use SilverStripe\Forms\SelectionGroup; +use SilverStripe\Forms\SelectionGroup_Item; +use SilverStripe\Forms\TreeDropdownField; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\ValidationException; use SilverStripe\Security\Member; use SilverStripe\Security\Security; -use FieldList; -use LiteralField; -use SelectionGroup; -use SelectionGroup_Item; -use SS_HTTPResponse; -use TreeDropdownField; -use OptionsetField; -use FormAction; -use Form; -use Session; -use Controller; -use SilverStripe\CMS\Model\SiteTree; - - class CMSPageAddController extends CMSPageEditController { @@ -160,6 +158,7 @@ class CMSPageAddController extends CMSPageEditController { } )); } + return null; }); $form->addExtraClass('cms-add-form cms-content center cms-edit-form ' . $this->BaseCSSClasses()); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); diff --git a/code/Controllers/CMSPageEditController.php b/code/Controllers/CMSPageEditController.php index bcbcdb69..360e2187 100644 --- a/code/Controllers/CMSPageEditController.php +++ b/code/Controllers/CMSPageEditController.php @@ -2,9 +2,12 @@ namespace SilverStripe\CMS\Controllers; -use Convert; use SilverStripe\Admin\AddToCampaignHandler; -use SS_HTTPResponse; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Core\Convert; +use SilverStripe\Forms\Form; +use SilverStripe\ORM\FieldType\DBHTMLText; /** * @package cms @@ -48,18 +51,19 @@ class CMSPageEditController extends CMSMain { $handler = AddToCampaignHandler::create($this, $record); $results = $handler->addToCampaign($record, $data['Campaign']); - if (!is_null($results)) { - $request = $this->getRequest(); - if($request->getHeader('X-Formschema-Request')) { - $data = $this->getSchemaForForm($handler->Form($record)); - $data['message'] = $results; - - $response = new SS_HTTPResponse(Convert::raw2json($data)); - $response->addHeader('Content-Type', 'application/json'); - return $response; - } - return $results; + if (is_null($results)) { + return null; } + $request = $this->getRequest(); + if($request->getHeader('X-Formschema-Request')) { + $data = $this->getSchemaForForm($handler->Form($record)); + $data['message'] = $results; + + $response = new SS_HTTPResponse(Convert::raw2json($data)); + $response->addHeader('Content-Type', 'application/json'); + return $response; + } + return $results; } /** diff --git a/code/Controllers/CMSPageHistoryController.php b/code/Controllers/CMSPageHistoryController.php index f6ad93b2..75a80c62 100644 --- a/code/Controllers/CMSPageHistoryController.php +++ b/code/Controllers/CMSPageHistoryController.php @@ -3,25 +3,21 @@ namespace SilverStripe\CMS\Controllers; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Forms\CheckboxField; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\Form; +use SilverStripe\Forms\FormAction; +use SilverStripe\Forms\HiddenField; +use SilverStripe\Forms\LiteralField; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\Security\Security; -use Form; -use FieldList; -use FormAction; -use HiddenField; -use Controller; -use LiteralField; -use SS_HTTPRequest; -use SS_HTTPResponse; -use ViewableData; -use CheckboxField; +use SilverStripe\View\ViewableData; -/** - * @package cms - * @subpackage controllers - */ class CMSPageHistoryController extends CMSMain { private static $url_segment = 'pages/history'; @@ -181,7 +177,7 @@ class CMSPageHistoryController extends CMSMain { new LiteralField('CurrentlyViewingMessage', $this->customise(array( 'Content' => DBField::create_field('HTMLFragment', $message), 'Classes' => 'notice' - ))->renderWith(array('CMSMain_notice'))), + ))->renderWith($this->getTemplatesWithSuffix('_notice'))), "Title" ); diff --git a/code/Controllers/CMSPageSettingsController.php b/code/Controllers/CMSPageSettingsController.php index ab06decc..77a077e1 100644 --- a/code/Controllers/CMSPageSettingsController.php +++ b/code/Controllers/CMSPageSettingsController.php @@ -2,9 +2,6 @@ namespace SilverStripe\CMS\Controllers; -/** - * @package cms - */ class CMSPageSettingsController extends CMSMain { private static $url_segment = 'pages/settings'; diff --git a/code/Controllers/CMSPagesController.php b/code/Controllers/CMSPagesController.php index 16334f03..07ae0e92 100644 --- a/code/Controllers/CMSPagesController.php +++ b/code/Controllers/CMSPagesController.php @@ -3,14 +3,11 @@ namespace SilverStripe\CMS\Controllers; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; use SilverStripe\ORM\DataObject; +use SilverStripe\View\ArrayData; use stdClass; -use Controller; -use ArrayData; -/** - * @package cms - */ class CMSPagesController extends CMSMain { private static $url_segment = 'pages'; diff --git a/code/Controllers/CMSSiteTreeFilter.php b/code/Controllers/CMSSiteTreeFilter.php index a3361be5..c5b57fc6 100644 --- a/code/Controllers/CMSSiteTreeFilter.php +++ b/code/Controllers/CMSSiteTreeFilter.php @@ -2,15 +2,14 @@ namespace SilverStripe\CMS\Controllers; +use SilverStripe\Admin\LeftAndMain_SearchFilter; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Core\Object; +use SilverStripe\Forms\DateField; use SilverStripe\ORM\DataList; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\Versioning\Versioned; -use Object; -use ClassInfo; -use DateField; -use SilverStripe\Admin\LeftAndMain_SearchFilter; - /** * Base class for filtering the subtree for certain node statuses. @@ -22,9 +21,6 @@ use SilverStripe\Admin\LeftAndMain_SearchFilter; * If you wish to make a more complex tree, you can overload includeInTree($page) to return true/ * false depending on whether the given page should be included. Note that you will need to include * parent helper pages yourself. - * - * @package cms - * @subpackage content */ abstract class CMSSiteTreeFilter extends Object implements LeftAndMain_SearchFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_ChangedPages.php b/code/Controllers/CMSSiteTreeFilter_ChangedPages.php index 4459455a..0ab8a807 100644 --- a/code/Controllers/CMSSiteTreeFilter_ChangedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_ChangedPages.php @@ -6,9 +6,6 @@ use SilverStripe\ORM\Versioning\Versioned; /** * Gets all pages which have changed on stage. - * - * @package cms - * @subpackage content */ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_DeletedPages.php b/code/Controllers/CMSSiteTreeFilter_DeletedPages.php index 9f204b4a..624fbd58 100644 --- a/code/Controllers/CMSSiteTreeFilter_DeletedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_DeletedPages.php @@ -8,9 +8,6 @@ use SilverStripe\ORM\Versioning\Versioned; * Works a bit different than the other filters: * Shows all pages *including* those deleted from stage and live. * It does not filter out pages still existing in the different stages. - * - * @package cms - * @subpackage content */ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_PublishedPages.php b/code/Controllers/CMSSiteTreeFilter_PublishedPages.php index 7917b820..aecbdca1 100644 --- a/code/Controllers/CMSSiteTreeFilter_PublishedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_PublishedPages.php @@ -11,9 +11,6 @@ use SilverStripe\ORM\Versioning\Versioned; * pages that is currently published. * * Note that this does not check canView permissions that might hide pages from certain visitors - * - * @package cms - * @subpackage content */ class CMSSiteTreeFilter_PublishedPages extends CMSSiteTreeFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_Search.php b/code/Controllers/CMSSiteTreeFilter_Search.php index 3b0d1a39..6cedb889 100644 --- a/code/Controllers/CMSSiteTreeFilter_Search.php +++ b/code/Controllers/CMSSiteTreeFilter_Search.php @@ -4,10 +4,6 @@ namespace SilverStripe\CMS\Controllers; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\Versioning\Versioned; -/** - * @package cms - * @subpackage content - */ class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php b/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php index 7cfc0bf3..8d277092 100644 --- a/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php @@ -8,9 +8,6 @@ use SilverStripe\ORM\Versioning\Versioned; /** * Filters pages which have a status "Deleted". - * - * @package cms - * @subpackage content */ class CMSSiteTreeFilter_StatusDeletedPages extends CMSSiteTreeFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_StatusDraftPages.php b/code/Controllers/CMSSiteTreeFilter_StatusDraftPages.php index c65a8452..6893465e 100644 --- a/code/Controllers/CMSSiteTreeFilter_StatusDraftPages.php +++ b/code/Controllers/CMSSiteTreeFilter_StatusDraftPages.php @@ -8,9 +8,6 @@ use SilverStripe\ORM\Versioning\Versioned; /** * Filters pages which have a status "Draft". - * - * @package cms - * @subpackage content */ class CMSSiteTreeFilter_StatusDraftPages extends CMSSiteTreeFilter { diff --git a/code/Controllers/CMSSiteTreeFilter_StatusRemovedFromDraftPages.php b/code/Controllers/CMSSiteTreeFilter_StatusRemovedFromDraftPages.php index 874ab051..aab48573 100644 --- a/code/Controllers/CMSSiteTreeFilter_StatusRemovedFromDraftPages.php +++ b/code/Controllers/CMSSiteTreeFilter_StatusRemovedFromDraftPages.php @@ -8,9 +8,6 @@ use SilverStripe\ORM\Versioning\Versioned; /** * Filters pages which have a status "Removed from Draft". - * - * @package cms - * @subpackage content */ class CMSSiteTreeFilter_StatusRemovedFromDraftPages extends CMSSiteTreeFilter { diff --git a/code/Controllers/ContentController.php b/code/Controllers/ContentController.php index 6a0a5ae6..35618b06 100755 --- a/code/Controllers/ContentController.php +++ b/code/Controllers/ContentController.php @@ -2,35 +2,34 @@ namespace SilverStripe\CMS\Controllers; -use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\DataModel; +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Control\Director; +use SilverStripe\Control\Session; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Core\Convert; +use SilverStripe\i18n\i18n; use SilverStripe\ORM\ArrayList; +use SilverStripe\ORM\DataModel; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBField; +use SilverStripe\ORM\FieldType\DBHTMLText; +use SilverStripe\ORM\FieldType\DBVarchar; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\Versioning\Versioned; -use SilverStripe\ORM\FieldType\DBVarchar; -use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\Security\Security; -use SilverStripe\Security\MemberAuthenticator; use SilverStripe\Security\Member; +use SilverStripe\Security\MemberAuthenticator; use SilverStripe\Security\Permission; -use Controller; +use SilverStripe\Security\Security; +use SilverStripe\SiteConfig\SiteConfig; +use SilverStripe\View\ArrayData; +use SilverStripe\View\Requirements; +use SilverStripe\View\SSViewer; use Page; -use SiteConfig; -use SS_HTTPRequest; use Translatable; -use i18n; -use SS_HTTPResponse; -use SS_HTTPResponse_Exception; -use Director; -use Requirements; -use Convert; -use SSViewer; -use ArrayData; -use Session; -use SilverStripe\CMS\Model\SiteTree; - /** * The most common kind of controller; effectively a controller linked to a {@link DataObject}. @@ -47,9 +46,6 @@ use SilverStripe\CMS\Model\SiteTree; * a controller based on the URLSegment action variable, by looking in the SiteTree table. * * @todo Can this be used for anything other than SiteTree controllers? - * - * @package cms - * @subpackage control */ class ContentController extends Controller { @@ -423,10 +419,10 @@ HTML; // Find templates by dataRecord SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SilverStripe\\CMS\\Model\\SiteTree"), // Next, we need to add templates for all controllers - SSViewer::get_templates_by_class(get_class($this), $action, "Controller"), + SSViewer::get_templates_by_class(get_class($this), $action, "SilverStripe\\Control\\Controller"), // Fail-over to the same for the "index" action SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SilverStripe\\CMS\\Model\\SiteTree"), - SSViewer::get_templates_by_class(get_class($this), "", "Controller") + SSViewer::get_templates_by_class(get_class($this), "", "SilverStripe\\Control\\Controller") ); return new SSViewer($templates); diff --git a/code/Controllers/ErrorPageControllerExtension.php b/code/Controllers/ErrorPageControllerExtension.php index 26715d82..3ae2fcf8 100644 --- a/code/Controllers/ErrorPageControllerExtension.php +++ b/code/Controllers/ErrorPageControllerExtension.php @@ -2,17 +2,14 @@ namespace SilverStripe\CMS\Controllers; -use Extension; -use SS_HTTPRequest; -use SS_HTTPResponse_Exception; use SilverStripe\CMS\Model\ErrorPage; - +use SilverStripe\Control\Director; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Core\Extension; /** * Enhances error handling for a controller with ErrorPage generated output - * - * @package cms - * @subpackage controller */ class ErrorPageControllerExtension extends Extension { @@ -24,7 +21,7 @@ class ErrorPageControllerExtension extends Extension { * @throws SS_HTTPResponse_Exception */ public function onBeforeHTTPError($statusCode, $request) { - if (\Director::is_ajax()) { + if (Director::is_ajax()) { return; } $response = ErrorPage::response_for($statusCode); diff --git a/code/Controllers/LeftAndMainPageIconsExtension.php b/code/Controllers/LeftAndMainPageIconsExtension.php index 7c97c677..c088fc4a 100644 --- a/code/Controllers/LeftAndMainPageIconsExtension.php +++ b/code/Controllers/LeftAndMainPageIconsExtension.php @@ -2,16 +2,13 @@ namespace SilverStripe\CMS\Controllers; -use Extension; -use Requirements; -use ClassInfo; -use Director; +use SilverStripe\View\Requirements; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Control\Director; +use SilverStripe\Core\Extension; /** * Extension to include custom page icons - * - * @package cms - * @subpackage controller */ class LeftAndMainPageIconsExtension extends Extension { diff --git a/code/Controllers/ModelAsController.php b/code/Controllers/ModelAsController.php index b1b9002d..0524ec04 100644 --- a/code/Controllers/ModelAsController.php +++ b/code/Controllers/ModelAsController.php @@ -2,31 +2,27 @@ namespace SilverStripe\CMS\Controllers; -use NestedController; +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Control\Director; +use SilverStripe\Control\NestedController; +use SilverStripe\Control\RequestHandler; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Core\Injector\Injector; +use SilverStripe\Dev\Debug; +use SilverStripe\Dev\Deprecation; use SilverStripe\ORM\DataModel; -use SilverStripe\ORM\DB; use SilverStripe\ORM\DataObject; -use Controller; -use ClassInfo; -use Injector; -use SS_HTTPRequest; -use Director; -use RequestHandler; -use SS_HTTPResponse; -use SS_HTTPResponse_Exception; +use SilverStripe\ORM\DB; use Exception; use Translatable; -use Debug; -use Deprecation; -use SilverStripe\CMS\Model\SiteTree; - /** * ModelAsController deals with mapping the initial request to the first {@link SiteTree}/{@link ContentController} * pair, which are then used to handle the request. - * - * @package cms - * @subpackage control */ class ModelAsController extends Controller implements NestedController { @@ -46,9 +42,13 @@ class ModelAsController extends Controller implements NestedController { } else { $ancestry = ClassInfo::ancestry($sitetree->class); while ($class = array_pop($ancestry)) { - if (class_exists($class . "_Controller")) break; + if (class_exists($class . "_Controller")) { + break; + } } - $controller = ($class !== null) ? "{$class}_Controller" : "SilverStripe\\CMS\\Controllers\\ContentController"; + $controller = ($class !== null) + ? "{$class}_Controller" + : "SilverStripe\\CMS\\Controllers\\ContentController"; } if($action && class_exists($controller . '_' . ucfirst($action))) { diff --git a/code/Controllers/OldPageRedirector.php b/code/Controllers/OldPageRedirector.php index 9fadde54..bb5bbd9d 100644 --- a/code/Controllers/OldPageRedirector.php +++ b/code/Controllers/OldPageRedirector.php @@ -2,14 +2,14 @@ namespace SilverStripe\CMS\Controllers; -use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\CMS\Model\SiteTree; -use Extension; -use Director; -use SS_HTTPRequest; -use SS_HTTPResponse; -use Controller; -use SS_HTTPResponse_Exception; +use SilverStripe\Control\Controller; +use SilverStripe\Control\Director; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Core\Extension; +use SilverStripe\ORM\Queries\SQLSelect; class OldPageRedirector extends Extension { diff --git a/code/Controllers/RootURLController.php b/code/Controllers/RootURLController.php index c1a6d868..5832fdea 100644 --- a/code/Controllers/RootURLController.php +++ b/code/Controllers/RootURLController.php @@ -3,21 +3,17 @@ namespace SilverStripe\CMS\Controllers; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Control\Director; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Core\Config\Config; +use SilverStripe\Dev\Deprecation; use SilverStripe\ORM\DataModel; use SilverStripe\ORM\DB; -use Controller; -use SS_HTTPResponse; use Translatable; -use Config; -use Deprecation; -use SS_HTTPRequest; -use ClassInfo; -use Director; -/** - * @package cms - * @subpackage control - */ class RootURLController extends Controller { /** diff --git a/code/Controllers/SilverStripeNavigator.php b/code/Controllers/SilverStripeNavigator.php index 73fdefa7..5acf7618 100644 --- a/code/Controllers/SilverStripeNavigator.php +++ b/code/Controllers/SilverStripeNavigator.php @@ -2,14 +2,12 @@ namespace SilverStripe\CMS\Controllers; +use SilverStripe\Admin\CMSPreviewable; +use SilverStripe\Core\ClassInfo; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\SS_List; -use ViewableData; -use ClassInfo; -use SilverStripe\Admin\CMSPreviewable; -use SiteTreeFutureState; - +use SilverStripe\View\ViewableData; /** * Utility class representing links to different views of a record @@ -20,9 +18,6 @@ use SiteTreeFutureState; * New item types can be defined by extending the {@link SilverStripeNavigatorItem} class, * for example the "cmsworkflow" module defines a new "future state" item with a date selector * to view embargoed data at a future point in time. So the item doesn't always have to be a simple link. - * - * @package cms - * @subpackage content */ class SilverStripeNavigator extends ViewableData { diff --git a/code/Controllers/SilverStripeNavigatorItem.php b/code/Controllers/SilverStripeNavigatorItem.php index 5834e4ea..4c248bb6 100644 --- a/code/Controllers/SilverStripeNavigatorItem.php +++ b/code/Controllers/SilverStripeNavigatorItem.php @@ -5,15 +5,12 @@ use SilverStripe\Admin\CMSPreviewable; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\Security\Member; -use ViewableData; +use SilverStripe\View\ViewableData; /** * Navigator items are links that appear in the $SilverStripeNavigator bar. * To add an item, extend this class - it will be automatically picked up. * When instanciating items manually, please ensure to call {@link canView()}. - * - * @package cms - * @subpackage content */ abstract class SilverStripeNavigatorItem extends ViewableData { @@ -66,6 +63,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData */ public function getLink() { + return null; } /** @@ -73,6 +71,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData */ public function getMessage() { + return null; } /** diff --git a/code/Controllers/SilverStripeNavigatorItem_ArchiveLink.php b/code/Controllers/SilverStripeNavigatorItem_ArchiveLink.php index 8248bffa..dd3161f1 100644 --- a/code/Controllers/SilverStripeNavigatorItem_ArchiveLink.php +++ b/code/Controllers/SilverStripeNavigatorItem_ArchiveLink.php @@ -7,10 +7,6 @@ use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\Versioning\Versioned; -/** - * @package cms - * @subpackage content - */ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem { /** @config */ diff --git a/code/Controllers/SilverStripeNavigatorItem_CMSLink.php b/code/Controllers/SilverStripeNavigatorItem_CMSLink.php index d04d901e..73798eca 100644 --- a/code/Controllers/SilverStripeNavigatorItem_CMSLink.php +++ b/code/Controllers/SilverStripeNavigatorItem_CMSLink.php @@ -1,14 +1,10 @@ URLSegment property, and suggest input based on the serverside rules * defined through {@link SiteTree->generateURLSegment()} and {@link URLSegmentFilter}. * * Note: The actual conversion for saving the value takes place in the model layer. - * - * @package cms - * @subpackage forms */ class SiteTreeURLSegmentField extends TextField { diff --git a/code/Forms/SiteTreeURLSegmentField_Readonly.php b/code/Forms/SiteTreeURLSegmentField_Readonly.php index 28501b24..e9b0886b 100644 --- a/code/Forms/SiteTreeURLSegmentField_Readonly.php +++ b/code/Forms/SiteTreeURLSegmentField_Readonly.php @@ -1,11 +1,9 @@ getTitle(); } diff --git a/code/Model/CurrentPageIdentifier.php b/code/Model/CurrentPageIdentifier.php index 169a1611..9794f6fb 100644 --- a/code/Model/CurrentPageIdentifier.php +++ b/code/Model/CurrentPageIdentifier.php @@ -6,8 +6,6 @@ use SilverStripe\ORM\DataObject; /** * This interface lets us set up objects that will tell us what the current page is. - * @package cms - * @subpackage model */ interface CurrentPageIdentifier { diff --git a/code/Model/ErrorPage.php b/code/Model/ErrorPage.php index 4bf3c6fb..9cf699d8 100644 --- a/code/Model/ErrorPage.php +++ b/code/Model/ErrorPage.php @@ -2,23 +2,21 @@ namespace SilverStripe\CMS\Model; -use FieldList; -use SilverStripe\Filesystem\Storage\GeneratedAssetHandler; +use SilverStripe\Assets\Storage\GeneratedAssetHandler; +use SilverStripe\Forms\FieldList; use SilverStripe\ORM\DataModel; use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\ORM\DB; -use Page; -use Requirements; use SilverStripe\CMS\Controllers\ModelAsController; -use SS_HTTPRequest; -use SS_HTTPResponse; -use DropdownField; -use File; -use Config; -use Director; -use Injector; -use Page_Controller; - +use SilverStripe\View\Requirements; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Control\SS_HTTPResponse; +use SilverStripe\Forms\DropdownField; +use SilverStripe\Assets\File; +use SilverStripe\Core\Config\Config; +use SilverStripe\Control\Director; +use SilverStripe\Core\Injector\Injector; +use Page; /** * ErrorPage holds the content for the page of an error response. @@ -31,7 +29,6 @@ use Page_Controller; * @see Debug::friendlyError() * * @property int $ErrorCode HTTP Error code - * @package cms */ class ErrorPage extends Page { @@ -299,7 +296,7 @@ class ErrorPage extends Page { // Run the page (reset the theme, it might've been disabled by LeftAndMain::init()) Config::nest(); - Config::inst()->update('SSViewer', 'theme_enabled', true); + Config::inst()->update('SilverStripe\\View\\SSViewer', 'theme_enabled', true); $response = Director::test(Director::makeRelative($this->Link())); Config::unnest(); $errorContent = $response->getBody(); diff --git a/code/Model/ErrorPage_Controller.php b/code/Model/ErrorPage_Controller.php index b396704f..517bfbe8 100644 --- a/code/Model/ErrorPage_Controller.php +++ b/code/Model/ErrorPage_Controller.php @@ -1,15 +1,14 @@ get('ContentNegotiator', 'encoding'); + $charset = Config::inst()->get('SilverStripe\\Control\\ContentNegotiator', 'encoding'); $tags[] = FormField::create_tag('meta', array( 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=' . $charset, @@ -1704,7 +1701,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid } if(!self::config()->nested_urls || !$this->ParentID) { - if(class_exists($this->URLSegment) && is_subclass_of($this->URLSegment, 'RequestHandler')) return false; + if(class_exists($this->URLSegment) && is_subclass_of($this->URLSegment, 'SilverStripe\\Control\\RequestHandler')) return false; } // Filters by url, id, and parent @@ -1928,7 +1925,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $dependentPages ); /** @var GridFieldDataColumns $dataColumns */ - $dataColumns = $dependentTable->getConfig()->getComponentByType('GridFieldDataColumns'); + $dataColumns = $dependentTable->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns'); $dataColumns ->setDisplayFields($dependentColumns) ->setFieldFormatting(array( @@ -1963,7 +1960,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $helpText = (self::config()->nested_urls && $this->Children()->count()) ? $this->fieldLabel('LinkChangeNote') : ''; - if(!Config::inst()->get('URLSegmentFilter', 'default_allow_multibyte')) { + if(!Config::inst()->get('SilverStripe\\View\\Parsers\\URLSegmentFilter', 'default_allow_multibyte')) { $helpText .= $helpText ? '
' : ''; $helpText .= _t('SiteTreeURLSegmentField.HelpChars', ' Special characters are automatically converted or removed.'); } @@ -2036,12 +2033,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid . "

"), "Title"); } - // Backwards compat: Rewrite nested "Content" tabs to toplevel - $fields->setTabPathRewrites(array( - '/^Root\.Content\.Main$/' => 'Root.Main', - '/^Root\.Content\.([^.]+)$/' => 'Root.\\1', - )); - if(self::$runCMSFieldsExtensions) { $this->extend('updateCMSFields', $fields); } @@ -2238,12 +2229,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $live = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', Versioned::LIVE, array( '"SiteTree"."ID"' => $this->ID )); + $infoTemplate = SSViewer::get_templates_by_class(get_class($this), '_Information', __CLASS__); $moreOptions->push( new LiteralField('Information', $this->customise(array( 'Live' => $live, 'ExistsOnLive' => $existsOnLive - ))->renderWith('SiteTree_Information') + ))->renderWith($infoTemplate) ) ); @@ -2254,7 +2246,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid '"SiteTree"."ID"' => $this->ID )); if($stageOrLiveRecord && $stageOrLiveRecord->Version != $this->Version) { - $moreOptions->push(FormAction::create('email', _t('CMSMain.EMAIL', 'Email'))); + $moreOptions->push(FormAction::create('email', _t('CMSMain.EMAIL', 'SilverStripe\\Control\\Email\\Email'))); $moreOptions->push(FormAction::create('rollback', _t('CMSMain.ROLLBACK', 'Roll back to this version'))); $actions = new FieldList(array($majorActions, $rootTabSet)); diff --git a/code/Model/SiteTreeExtension.php b/code/Model/SiteTreeExtension.php index bcbfec39..778faea0 100644 --- a/code/Model/SiteTreeExtension.php +++ b/code/Model/SiteTreeExtension.php @@ -7,9 +7,6 @@ use SilverStripe\Security\Member; /** * Plug-ins for additional functionality in your SiteTree classes. - * - * @package cms - * @subpackage model */ abstract class SiteTreeExtension extends DataExtension { diff --git a/code/Model/SiteTreeFileExtension.php b/code/Model/SiteTreeFileExtension.php index e2d2f04a..2fd0f41a 100644 --- a/code/Model/SiteTreeFileExtension.php +++ b/code/Model/SiteTreeFileExtension.php @@ -2,14 +2,14 @@ namespace SilverStripe\CMS\Model; -use File; +use SilverStripe\Assets\File; +use SilverStripe\Core\Convert; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\ReadonlyField; +use SilverStripe\ORM\DataExtension; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\Versioning\Versioned; -use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\DataExtension; -use FieldList; -use ReadonlyField; -use Convert; use Subsite; /** @@ -21,9 +21,6 @@ use Subsite; * only be enabled for the Stage record. * * @property File $owner - * - * @package cms - * @subpackage model */ class SiteTreeFileExtension extends DataExtension { diff --git a/code/Model/SiteTreeFolderExtension.php b/code/Model/SiteTreeFolderExtension.php index 762ec8bf..7eaf6e0d 100644 --- a/code/Model/SiteTreeFolderExtension.php +++ b/code/Model/SiteTreeFolderExtension.php @@ -2,17 +2,14 @@ namespace SilverStripe\CMS\Model; +use SilverStripe\Core\ClassInfo; use SilverStripe\ORM\DB; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataExtension; -use ClassInfo; /** * @todo Cleanup, refactor, test this class - * - * @package cms - * @subpackage model */ class SiteTreeFolderExtension extends DataExtension { @@ -39,14 +36,14 @@ class SiteTreeFolderExtension extends DataExtension { if(!count($ids)) continue; foreach(singleton($className)->hasOne() as $relName => $joinClass) { - if($joinClass == 'Image' || $joinClass == 'File') { + if($joinClass == 'SilverStripe\\Assets\\Image' || $joinClass == 'SilverStripe\\Assets\\File') { $fieldName = $relName .'ID'; $query = DataList::create($className)->where("$fieldName > 0"); $query->distinct = true; $query->select(array($fieldName)); $usedFiles = array_merge($usedFiles, $query->execute()->column()); - } elseif($joinClass == 'Folder') { + } elseif($joinClass == 'SilverStripe\\Assets\\Folder') { // @todo } } diff --git a/code/Model/SiteTreeLinkTracking.php b/code/Model/SiteTreeLinkTracking.php index 86fca6b0..c3459cc9 100644 --- a/code/Model/SiteTreeLinkTracking.php +++ b/code/Model/SiteTreeLinkTracking.php @@ -2,20 +2,12 @@ namespace SilverStripe\CMS\Model; -/** - * @package cms - * @subpackage model - */ - -use DOMElement; +use SilverStripe\Core\Injector\Injector; +use SilverStripe\ORM\DataExtension; +use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\Versioning\Versioned; -use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\DataExtension; -use SilverStripe\ORM\DataObject; -use Injector; -use SS_HTMLValue; -use Director; +use DOMElement; /** * Adds tracking of links in any HTMLText fields which reference SiteTree or File items. @@ -80,7 +72,7 @@ class SiteTreeLinkTracking extends DataExtension { private static $many_many = array( "LinkTracking" => "SilverStripe\\CMS\\Model\\SiteTree", - "ImageTracking" => "File" // {@see SiteTreeFileExtension} + "ImageTracking" => "SilverStripe\\Assets\\File" // {@see SiteTreeFileExtension} ); private static $belongs_many_many = array( diff --git a/code/Model/SiteTreeLinkTracking_Parser.php b/code/Model/SiteTreeLinkTracking_Parser.php index 51425ad8..0d9d4e13 100644 --- a/code/Model/SiteTreeLinkTracking_Parser.php +++ b/code/Model/SiteTreeLinkTracking_Parser.php @@ -1,9 +1,9 @@ getElementsByTagName('a'); if (!$links) { return $results; @@ -91,7 +92,7 @@ class SiteTreeLinkTracking_Parser 'Target' => $matches['id'], 'Anchor' => null, 'DOMReference' => $link, - 'Broken' => !DataObject::get_by_id('File', $matches['id']) + 'Broken' => !DataObject::get_by_id('SilverStripe\\Assets\\File', $matches['id']) ); continue; @@ -123,7 +124,7 @@ class SiteTreeLinkTracking_Parser 'Target' => (int)$id, 'Anchor' => null, 'DOMReference' => null, - 'Broken' => !DataObject::get_by_id('Image', (int)$id) + 'Broken' => !DataObject::get_by_id('SilverStripe\\Assets\\Image', (int)$id) ); } } diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index 3a11133a..f291647b 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -2,30 +2,23 @@ namespace SilverStripe\CMS\Model; -use Exception; -use SilverStripe\CMS\Controllers\ContentController; +use SilverStripe\Core\Convert; +use SilverStripe\Forms\LiteralField; +use SilverStripe\Forms\ReadonlyTransformation; +use SilverStripe\Forms\TreeDropdownField; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\Versioning\Versioned; -use Page; -use Convert; use SilverStripe\Security\Member; -use TreeDropdownField; -use ReadonlyTransformation; -use LiteralField; -use Page_Controller; -use SilverStripe\CMS\Controllers\ModelAsController; - +use Page; /** -* Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly. -* This allows you can have a page in mulitple places in the site structure, with different children without duplicating the content -* Note: This Only duplicates $db fields and not the $has_one etc.. + * Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly. + * This allows you can have a page in mulitple places in the site structure, with different children without duplicating the content + * Note: This Only duplicates $db fields and not the $has_one etc.. * * @method SiteTree CopyContentFrom() * @property int $CopyContentFromID - * -* @package cms -*/ + */ class VirtualPage extends Page { private static $description = 'Displays the content of another page'; diff --git a/code/Model/VirtualPage_Controller.php b/code/Model/VirtualPage_Controller.php index a06768b4..fc13b597 100644 --- a/code/Model/VirtualPage_Controller.php +++ b/code/Model/VirtualPage_Controller.php @@ -1,14 +1,13 @@ getVirtualisedController() ?: $this; - return $controller->getViewer($action); + $controller = $this->getVirtualisedController(); + if($controller) { + return $controller->getViewer($action); + } + return parent::getViewer($action); } /** diff --git a/code/Reports/BrokenFilesReport.php b/code/Reports/BrokenFilesReport.php index b3c179f9..278630b1 100644 --- a/code/Reports/BrokenFilesReport.php +++ b/code/Reports/BrokenFilesReport.php @@ -2,17 +2,13 @@ namespace SilverStripe\CMS\Reports; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Forms\CheckboxField; +use SilverStripe\Forms\FieldList; +use SilverStripe\Reports\SS_Report; use SilverStripe\ORM\DB; use SilverStripe\ORM\Versioning\Versioned; -use SS_Report; -use ClassInfo; -use FieldList; -use CheckboxField; -/** - * @package cms - * @subpackage reports - */ class BrokenFilesReport extends SS_Report { public function title() { diff --git a/code/Reports/BrokenLinksReport.php b/code/Reports/BrokenLinksReport.php index 9af09806..0c4ece6f 100644 --- a/code/Reports/BrokenLinksReport.php +++ b/code/Reports/BrokenLinksReport.php @@ -2,19 +2,19 @@ namespace SilverStripe\CMS\Reports; +use SilverStripe\CMS\Controllers\CMSPageEditController; +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Forms\DropdownField; +use SilverStripe\Forms\FieldList; use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\ArrayList; -use SS_Report; -use ClassInfo; -use Controller; -use FieldList; -use DropdownField; +use SilverStripe\Reports\SS_Report; /** * Content side-report listing pages with broken links - * @package cms - * @subpackage content */ class BrokenLinksReport extends SS_Report { @@ -55,6 +55,7 @@ class BrokenLinksReport extends SS_Report { $isRedirectorPage = in_array($record->ClassName, ClassInfo::subclassesFor('SilverStripe\\CMS\\Model\\RedirectorPage')); $isVirtualPage = in_array($record->ClassName, ClassInfo::subclassesFor('SilverStripe\\CMS\\Model\\VirtualPage')); + $reasonCodes = []; if ($isVirtualPage) { if ($record->HasBrokenLink) { $reason = _t('BrokenLinksReport.VirtualPageNonExistent', "virtual page pointing to non-existent page"); @@ -79,7 +80,9 @@ class BrokenLinksReport extends SS_Report { } if ($reason) { - if (isset($params['Reason']) && $params['Reason'] && !in_array($params['Reason'], $reasonCodes)) continue; + if (isset($params['Reason']) && $params['Reason'] && !in_array($params['Reason'], $reasonCodes)) { + continue; + } $record->BrokenReason = $reason; $returnSet->push($record); } @@ -96,7 +99,7 @@ class BrokenLinksReport extends SS_Report { $dateTitle = _t('BrokenLinksReport.ColumnDateLastPublished', 'Date last published'); } - $linkBase = singleton('SilverStripe\\CMS\\Controllers\\CMSPageEditController')->Link('show'); + $linkBase = CMSPageEditController::singleton()->Link('show'); $fields = array( "Title" => array( "title" => _t('BrokenLinksReport.PageName', 'Page name'), @@ -118,6 +121,7 @@ class BrokenLinksReport extends SS_Report { 'AbsoluteLink' => array( 'title' => _t('BrokenLinksReport.ColumnURL', 'URL'), 'formatting' => function($value, $item) { + /** @var SiteTree $item */ $liveLink = $item->AbsoluteLiveLink; $stageLink = $item->AbsoluteLink(); return sprintf('%s %s', diff --git a/code/Reports/BrokenRedirectorPagesReport.php b/code/Reports/BrokenRedirectorPagesReport.php index bc6a7c34..e742066c 100644 --- a/code/Reports/BrokenRedirectorPagesReport.php +++ b/code/Reports/BrokenRedirectorPagesReport.php @@ -2,18 +2,13 @@ namespace SilverStripe\CMS\Reports; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Forms\CheckboxField; +use SilverStripe\Forms\FieldList; use SilverStripe\ORM\DB; use SilverStripe\ORM\Versioning\Versioned; -use SS_Report; -use ClassInfo; -use FieldList; -use CheckboxField; -use Deprecation; +use SilverStripe\Reports\SS_Report; -/** - * @package cms - * @subpackage reports - */ class BrokenRedirectorPagesReport extends SS_Report { public function title() { diff --git a/code/Reports/BrokenVirtualPagesReport.php b/code/Reports/BrokenVirtualPagesReport.php index db11acf8..00a09f68 100644 --- a/code/Reports/BrokenVirtualPagesReport.php +++ b/code/Reports/BrokenVirtualPagesReport.php @@ -2,17 +2,13 @@ namespace SilverStripe\CMS\Reports; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Forms\CheckboxField; +use SilverStripe\Forms\FieldList; use SilverStripe\ORM\DB; use SilverStripe\ORM\Versioning\Versioned; -use SS_Report; -use ClassInfo; -use FieldList; -use CheckboxField; +use SilverStripe\Reports\SS_Report; -/** - * @package cms - * @subpackage reports - */ class BrokenVirtualPagesReport extends SS_Report { public function title() { diff --git a/code/Reports/EmptyPagesReport.php b/code/Reports/EmptyPagesReport.php index 5d0c4579..d9e26fca 100644 --- a/code/Reports/EmptyPagesReport.php +++ b/code/Reports/EmptyPagesReport.php @@ -2,14 +2,9 @@ namespace SilverStripe\CMS\Reports; -use SS_Report; use SilverStripe\CMS\Model\SiteTree; -use Deprecation; +use SilverStripe\Reports\SS_Report; -/** - * @package cms - * @subpackage reports - */ class EmptyPagesReport extends SS_Report { public function title() { diff --git a/code/Reports/RecentlyEditedReport.php b/code/Reports/RecentlyEditedReport.php index cda47a9d..0f7bb507 100644 --- a/code/Reports/RecentlyEditedReport.php +++ b/code/Reports/RecentlyEditedReport.php @@ -4,12 +4,8 @@ namespace SilverStripe\CMS\Reports; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\DataObject; -use SS_Report; +use SilverStripe\Reports\SS_Report; -/** - * @package cms - * @subpackage reports - */ class RecentlyEditedReport extends SS_Report { public function title() { diff --git a/code/Search/ContentControllerSearchExtension.php b/code/Search/ContentControllerSearchExtension.php index 8d79486f..66fbae93 100644 --- a/code/Search/ContentControllerSearchExtension.php +++ b/code/Search/ContentControllerSearchExtension.php @@ -2,18 +2,16 @@ namespace SilverStripe\CMS\Search; +use SilverStripe\Control\SS_HTTPRequest; +use SilverStripe\Core\Extension; +use SilverStripe\Forms\TextField; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\FormAction; use SilverStripe\ORM\FieldType\DBField; -use Extension; -use FieldList; -use TextField; -use FormAction; -use FulltextSearchable; +use SilverStripe\ORM\Search\FulltextSearchable; /** * Extension to provide a search interface when applied to ContentController - * - * @package cms - * @subpackage search */ class ContentControllerSearchExtension extends Extension { private static $allowed_actions = array( diff --git a/code/Search/SearchForm.php b/code/Search/SearchForm.php index ac5f7477..16188883 100644 --- a/code/Search/SearchForm.php +++ b/code/Search/SearchForm.php @@ -2,15 +2,16 @@ namespace SilverStripe\CMS\Search; -use Controller; +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\Form; +use SilverStripe\Forms\FormAction; +use SilverStripe\Forms\HiddenField; +use SilverStripe\Forms\TextField; use SilverStripe\ORM\DB; use SilverStripe\ORM\SS_List; -use Form; -use FieldList; -use TextField; -use HiddenField; use Translatable; -use FormAction; /** * Standard basic search form which conducts a fulltext search on all {@link SiteTree} @@ -22,8 +23,6 @@ use FormAction; * with {@link Translatable::get_current_locale()} when then form is constructed. * * @see Use ModelController and SearchContext for a more generic search implementation based around DataObject - * @package cms - * @subpackage search */ class SearchForm extends Form { @@ -37,7 +36,8 @@ class SearchForm extends Form { * Classes to search */ protected $classesToSearch = array( - "SilverStripe\\CMS\\Model\\SiteTree", "File" + "SilverStripe\\CMS\\Model\\SiteTree", + "SilverStripe\\Assets\\File" ); private static $casting = array( @@ -59,7 +59,9 @@ class SearchForm extends Form { )); } - if(class_exists('Translatable') && singleton('SilverStripe\\CMS\\Model\\SiteTree')->hasExtension('Translatable')) { + if(class_exists('Translatable') + && SiteTree::singleton()->hasExtension('Translatable') + ) { $fields->push(new HiddenField('searchlocale', 'searchlocale', Translatable::get_current_locale())); } @@ -86,7 +88,7 @@ class SearchForm extends Form { public function forTemplate() { $return = $this->renderWith(array_merge( (array)$this->getTemplate(), - array('SilverStripe\\CMS\\Search\\SearchForm', 'Form') + array('SilverStripe\\CMS\\Search\\SearchForm', 'SilverStripe\\Forms\\Form') )); // Now that we're rendered, clear message @@ -98,13 +100,20 @@ class SearchForm extends Form { /** * Set the classes to search. * Currently you can only choose from "SiteTree" and "File", but a future version might improve this. - */ + * + * @param array $classes + */ public function classesToSearch($classes) { - $illegalClasses = array_diff($classes, array('SilverStripe\\CMS\\Model\\SiteTree', 'File')); + $supportedClasses = array('SilverStripe\\CMS\\Model\\SiteTree', 'SilverStripe\\Assets\\File'); + $illegalClasses = array_diff($classes, $supportedClasses); if($illegalClasses) { - user_error("SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses) . "'. At this stage, only File and SiteTree are allowed", E_USER_WARNING); + user_error( + "SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses) + . "'. At this stage, only File and SiteTree are allowed", + E_USER_WARNING + ); } - $legalClasses = array_intersect($classes, array('SilverStripe\\CMS\\Model\\SiteTree', 'File')); + $legalClasses = array_intersect($classes, $supportedClasses); $this->classesToSearch = $legalClasses; } @@ -131,7 +140,7 @@ class SearchForm extends Form { // set language (if present) if(class_exists('Translatable')) { - if(singleton('SilverStripe\\CMS\\Model\\SiteTree')->hasExtension('Translatable') && isset($data['searchlocale'])) { + if(SiteTree::singleton()->hasExtension('Translatable') && isset($data['searchlocale'])) { if($data['searchlocale'] == "ALL") { Translatable::disable_locale_filter(); } else { @@ -174,7 +183,7 @@ class SearchForm extends Form { // reset locale if(class_exists('Translatable')) { - if(singleton('SilverStripe\\CMS\\Model\\SiteTree')->hasExtension('Translatable') && isset($data['searchlocale'])) { + if(SiteTree::singleton()->hasExtension('Translatable') && isset($data['searchlocale'])) { if($data['searchlocale'] == "ALL") { Translatable::enable_locale_filter(); } else { @@ -190,6 +199,7 @@ class SearchForm extends Form { if(!trim($keywords)) return ""; // Add * to each keyword $splitWords = preg_split("/ +/" , trim($keywords)); + $newWords = []; while(list($i,$word) = each($splitWords)) { if($word[0] == '"') { while(list($i,$subword) = each($splitWords)) { @@ -212,10 +222,16 @@ class SearchForm extends Form { */ public function getSearchQuery($data = null) { // legacy usage: $data was defaulting to $_REQUEST, parameter not passed in doc.silverstripe.org tutorials - if(!isset($data)) $data = $_REQUEST; + if(!isset($data)) { + $data = $_REQUEST; + } // The form could be rendered without the search being done, so check for that. - if (isset($data['Search'])) return $data['Search']; + if (isset($data['Search'])) { + return $data['Search']; + } + + return null; } /** diff --git a/code/Tasks/MigrateSiteTreeLinkingTask.php b/code/Tasks/MigrateSiteTreeLinkingTask.php index 214d5145..51b91fee 100644 --- a/code/Tasks/MigrateSiteTreeLinkingTask.php +++ b/code/Tasks/MigrateSiteTreeLinkingTask.php @@ -2,21 +2,18 @@ namespace SilverStripe\CMS\Tasks; - +use SilverStripe\Dev\BuildTask; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\DB; use SilverStripe\ORM\DataObject; -use BuildTask; - +use SilverStripe\ORM\DB; /** * Rewrites plain internal HTML links into shortcode form, using existing link tracking information. - * - * @package cms - * @subpackage tasks */ class MigrateSiteTreeLinkingTask extends BuildTask { + private static $segment = 'MigrateSiteTreeLinkingTask'; + protected $title = 'Migrate SiteTree Linking Task'; protected $description = 'Rewrites plain internal HTML links into shortcode form, using existing link tracking information.'; diff --git a/code/Tasks/RemoveOrphanedPagesTask.php b/code/Tasks/RemoveOrphanedPagesTask.php index 7bacd549..561c7290 100644 --- a/code/Tasks/RemoveOrphanedPagesTask.php +++ b/code/Tasks/RemoveOrphanedPagesTask.php @@ -2,27 +2,22 @@ namespace SilverStripe\CMS\Tasks; - +use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; +use SilverStripe\Forms\CheckboxSetField; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\Form; +use SilverStripe\Forms\FormAction; +use SilverStripe\Forms\HeaderField; +use SilverStripe\Forms\LiteralField; +use SilverStripe\Forms\OptionsetField; +use SilverStripe\ORM\ArrayList; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\Versioning\Versioned; -use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\ArrayList; use SilverStripe\Security\Permission; use SilverStripe\Security\Security; -use SilverStripe\CMS\Model\SiteTree; -use Controller; -use Requirements; -use FieldList; -use HeaderField; -use LiteralField; -use CheckboxSetField; -use OptionsetField; -use Form; -use FormAction; - - - - +use SilverStripe\View\Requirements; /** * Identify "orphaned" pages which point to a parent @@ -41,11 +36,7 @@ use FormAction; * before and after orphan removal. * * @author Ingo Schommer (@silverstripe.com), SilverStripe Ltd. - * - * @package cms - * @subpackage tasks */ -//class RemoveOrphanedPagesTask extends BuildTask { class RemoveOrphanedPagesTask extends Controller { private static $allowed_actions = array( @@ -77,12 +68,13 @@ in the other stage:
parent::init(); if(!Permission::check('ADMIN')) { - return Security::permissionFailure($this); + Security::permissionFailure($this); } } public function Link($action = null) { + /** @skipUpgrade */ return Controller::join_links('RemoveOrphanedPagesTask', $action, '/'); } @@ -109,6 +101,7 @@ in the other stage:
$orphans = $this->getOrphanedPages($this->orphanedSearchClass); if($orphans) foreach($orphans as $orphan) { + /** @var SiteTree $latestVersion */ $latestVersion = Versioned::get_latest_version($this->orphanedSearchClass, $orphan->ID); $latestAuthor = DataObject::get_by_id('SilverStripe\\Security\\Member', $latestVersion->AuthorID); $orphanBaseTable = DataObject::getSchema()->baseDataTable($this->orphanedSearchClass); @@ -181,7 +174,7 @@ in the other stage:
$form = new Form( $this, - 'Form', + 'SilverStripe\\Forms\\Form', $fields, new FieldList( new FormAction('doSubmit', _t('RemoveOrphanedPagesTask.BUTTONRUN', 'Run')) @@ -281,6 +274,7 @@ in the other stage:
$removedOrphans = array(); $orphanBaseTable = DataObject::getSchema()->baseDataTable($this->orphanedSearchClass); foreach($orphanIDs as $id) { + /** @var SiteTree $stageRecord */ $stageRecord = Versioned::get_one_by_stage( $this->orphanedSearchClass, 'Stage', @@ -296,6 +290,7 @@ in the other stage:
$stageRecord->destroy(); //unset($stageRecord); } + /** @var SiteTree $liveRecord */ $liveRecord = Versioned::get_one_by_stage( $this->orphanedSearchClass, 'Live', @@ -307,7 +302,9 @@ in the other stage:
$liveRecord->ShowInMenus = 0; $liveRecord->ShowInSearch = 0; $liveRecord->write(); - if(!$stageRecord) $liveRecord->doRestoreToStage(); + if(!$stageRecord) { + $liveRecord->doRestoreToStage(); + } $liveRecord->doUnpublish(); $liveRecord->destroy(); unset($liveRecord); diff --git a/code/Tasks/SiteTreeMaintenanceTask.php b/code/Tasks/SiteTreeMaintenanceTask.php index 28bd8bd9..559bcd54 100644 --- a/code/Tasks/SiteTreeMaintenanceTask.php +++ b/code/Tasks/SiteTreeMaintenanceTask.php @@ -2,16 +2,10 @@ namespace SilverStripe\CMS\Tasks; - +use SilverStripe\Control\Controller; use SilverStripe\ORM\DB; use SilverStripe\ORM\DataObject; -use Controller; - -/** - * @package cms - * @subpackage tasks - */ class SiteTreeMaintenanceTask extends Controller { private static $allowed_actions = array( '*' => 'ADMIN' @@ -45,6 +39,7 @@ class SiteTreeMaintenanceTask extends Controller { public function Link($action = null) { + /** @skipUpgrade */ return Controller::join_links('SiteTreeMaintenanceTask', $action, '/'); } } diff --git a/templates/SSReportTableField_printable.ss b/templates/SSReportTableField_printable.ss deleted file mode 100644 index 017db6a8..00000000 --- a/templates/SSReportTableField_printable.ss +++ /dev/null @@ -1,26 +0,0 @@ - - - - -<% base_tag %> -Print - - -<%-- --%> - - <% with $Form.Controller %> -

$CurrentReport.Title

- <% with $CurrentReport.getCmsFields %> - <% if $Name == Filters %> -

Filters

- - <% end_if %> - <% end_with %> - <% end_with %> - <% include TableListField %> - - diff --git a/templates/CMSMain_notice.ss b/templates/SilverStripe/CMS/Controllers/Includes/CMSMain_notice.ss similarity index 100% rename from templates/CMSMain_notice.ss rename to templates/SilverStripe/CMS/Controllers/Includes/CMSMain_notice.ss diff --git a/templates/SiteTree_Information.ss b/templates/SilverStripe/CMS/Model/Includes/SiteTree_Information.ss similarity index 100% rename from templates/SiteTree_Information.ss rename to templates/SilverStripe/CMS/Model/Includes/SiteTree_Information.ss diff --git a/templates/SilverStripe/CMS/Search/Includes/SearchForm.ss b/templates/SilverStripe/CMS/Search/Includes/SearchForm.ss new file mode 100644 index 00000000..8b4c9c14 --- /dev/null +++ b/templates/SilverStripe/CMS/Search/Includes/SearchForm.ss @@ -0,0 +1,15 @@ +
+ <% if $Message %> +

$Message

+ <% else %> + + <% end_if %> +
+ <% loop $Fields %> + $FieldHolder + <% end_loop %> + <% loop $Actions %> + $Field + <% end_loop %> +
+
diff --git a/templates/SilverStripeNavigatorLink.ss b/templates/SilverStripeNavigatorLink.ss deleted file mode 100644 index a23e9ad8..00000000 --- a/templates/SilverStripeNavigatorLink.ss +++ /dev/null @@ -1,10 +0,0 @@ -    - - <% _t('SilverStripeNavigatorLink.ShareLink','Share link') %> - -
- <% _t('SilverStripeNavigatorLinkl.CloseLink','Close') %> -

- <% _t('SilverStripeNavigatorLink.ShareInstructions','To share this page, copy and paste the link below.') %>

- -
diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 7efd303b..28a195ee 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -11,6 +11,9 @@ use SilverStripe\BehatExtension\Context\SilverStripeContext, SilverStripe\Cms\Test\Behaviour, SilverStripe\ORM\Versioning\Versioned; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Core\Injector\Injector; + /** @@ -40,8 +43,8 @@ class FeatureContext extends \SilverStripe\Framework\Test\Behaviour\FeatureConte // Use blueprints which auto-publish all subclasses of SiteTree $factory = $fixtureContext->getFixtureFactory(); - foreach(\ClassInfo::subclassesFor('SilverStripe\\CMS\\Model\\SiteTree') as $id => $class) { - $blueprint = \Injector::inst()->create('FixtureBlueprint', $class); + foreach(ClassInfo::subclassesFor('SilverStripe\\CMS\\Model\\SiteTree') as $id => $class) { + $blueprint = Injector::inst()->create('SilverStripe\\Dev\\FixtureBlueprint', $class); $blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) { /** @var SiteTree $obj */ $obj->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); diff --git a/tests/controller/CMSBatchActionsTest.php b/tests/controller/CMSBatchActionsTest.php index 3efa9de2..75210312 100644 --- a/tests/controller/CMSBatchActionsTest.php +++ b/tests/controller/CMSBatchActionsTest.php @@ -6,6 +6,8 @@ use SilverStripe\CMS\BatchActions\CMSBatchAction_Unpublish; use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive; use SilverStripe\CMS\BatchActions\CMSBatchAction_Restore; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Dev\SapphireTest; + /** diff --git a/tests/controller/CMSMainTest.php b/tests/controller/CMSMainTest.php index 06d29345..c3dbc05d 100644 --- a/tests/controller/CMSMainTest.php +++ b/tests/controller/CMSMainTest.php @@ -8,6 +8,17 @@ use SilverStripe\ORM\HiddenClass; use SilverStripe\CMS\Controllers\CMSMain; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Admin\CMSBatchActionHandler; +use SilverStripe\SiteConfig\SiteConfig; +use SilverStripe\Core\SS_Cache; +use SilverStripe\Core\Convert; +use SilverStripe\Core\ClassInfo; +use SilverStripe\Dev\TestOnly; +use SilverStripe\Forms\FieldList; +use SilverStripe\Core\Config\Config; +use SilverStripe\Dev\CSSContentParser; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Dev\FunctionalTest; + @@ -25,7 +36,7 @@ class CMSMainTest extends FunctionalTest { parent::setUp(); // Clear automatically created siteconfigs (in case one was created outside of the specified fixtures). - $ids = $this->allFixtureIDs('SiteConfig'); + $ids = $this->allFixtureIDs('SilverStripe\\SiteConfig\\SiteConfig'); if($ids) { foreach(SiteConfig::get()->exclude('ID', $ids) as $config) { $config->delete(); @@ -534,7 +545,7 @@ class CMSMainTest extends FunctionalTest { $page = $this->objFromFixture('Page', 'page1'); $controller = new CMSMain(); $form = $controller->getEditForm($page->ID); - $this->assertInstanceOf("Form", $form); + $this->assertInstanceOf("SilverStripe\\Forms\\Form", $form); // Ensure that the form will not "validate" on delete or "unpublish" actions. $exemptActions = $form->getValidationExemptActions(); diff --git a/tests/controller/CMSMainTest.yml b/tests/controller/CMSMainTest.yml index fbe2ed61..f053d774 100644 --- a/tests/controller/CMSMainTest.yml +++ b/tests/controller/CMSMainTest.yml @@ -121,13 +121,13 @@ SilverStripe\Security\Permission: allcmssections2: Code: CMS_ACCESS_LeftAndMain GroupID: =>SilverStripe\Security\Group.rooteditusers -SiteConfig: +SilverStripe\SiteConfig\SiteConfig: siteconfig1: EditorGroups: =>SilverStripe\Security\Group.rooteditusers CanCreateTopLevelType: 'OnlyTheseUsers' SiteConfig_CreateTopLevelGroups: createtoplevelgroups1: - SiteConfigID: =>SiteConfig.siteconfig1 + SiteConfigID: =>SilverStripe\SiteConfig\SiteConfig.siteconfig1 GroupID: =>SilverStripe\Security\Group.rooteditusers SilverStripe\CMS\Model\RedirectorPage: page5: diff --git a/tests/controller/CMSPageHistoryControllerTest.php b/tests/controller/CMSPageHistoryControllerTest.php index f00867b9..3e78b8c6 100755 --- a/tests/controller/CMSPageHistoryControllerTest.php +++ b/tests/controller/CMSPageHistoryControllerTest.php @@ -2,6 +2,8 @@ use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\CMS\Controllers\CMSPageHistoryController; +use SilverStripe\Dev\FunctionalTest; + /** diff --git a/tests/controller/CMSSiteTreeFilterTest.php b/tests/controller/CMSSiteTreeFilterTest.php index 48503e33..11c50b6d 100644 --- a/tests/controller/CMSSiteTreeFilterTest.php +++ b/tests/controller/CMSSiteTreeFilterTest.php @@ -7,6 +7,8 @@ use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_DeletedPages; use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusDraftPages; use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusRemovedFromDraftPages; use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusDeletedPages; +use SilverStripe\Dev\SapphireTest; + class CMSSiteTreeFilterTest extends SapphireTest { diff --git a/tests/controller/ContentControllerPermissionsTest.php b/tests/controller/ContentControllerPermissionsTest.php index 32e46998..ab5f3697 100644 --- a/tests/controller/ContentControllerPermissionsTest.php +++ b/tests/controller/ContentControllerPermissionsTest.php @@ -1,6 +1,10 @@ SearchForm(); - if (get_class($form) == 'SilverStripe\\CMS\\Search\\SearchForm') $this->assertEquals(array('File'), $form->getClassesToSearch()); + if (get_class($form) == 'SilverStripe\\CMS\\Search\\SearchForm') $this->assertEquals(array('SilverStripe\\Assets\\File'), $form->getClassesToSearch()); } public function setUpOnce() { parent::setUpOnce(); - FulltextSearchable::enable('File'); + FulltextSearchable::enable('SilverStripe\\Assets\\File'); } /** @@ -32,8 +37,8 @@ class ContentControllerSearchExtensionTest extends SapphireTest { public function tearDownOnce() { parent::tearDownOnce(); - Config::inst()->update('File', 'create_table_options', array('SilverStripe\ORM\Connect\MySQLDatabase' => 'ENGINE=InnoDB')); - File::remove_extension('FulltextSearchable'); + Config::inst()->update('SilverStripe\\Assets\\File', 'create_table_options', array('SilverStripe\ORM\Connect\MySQLDatabase' => 'ENGINE=InnoDB')); + File::remove_extension('SilverStripe\\ORM\\Search\\FulltextSearchable'); } } diff --git a/tests/controller/ContentControllerTest.php b/tests/controller/ContentControllerTest.php index b7eeda25..e42e72a5 100755 --- a/tests/controller/ContentControllerTest.php +++ b/tests/controller/ContentControllerTest.php @@ -4,7 +4,10 @@ use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\CMS\Controllers\RootURLController; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Controllers\ContentController; - +use SilverStripe\Core\Config\Config; +use SilverStripe\Control\Director; +use SilverStripe\Control\SS_HTTPResponse_Exception; +use SilverStripe\Dev\FunctionalTest; /** * @package cms diff --git a/tests/controller/ModelAsControllerTest.php b/tests/controller/ModelAsControllerTest.php index 1f3709ae..74547a26 100644 --- a/tests/controller/ModelAsControllerTest.php +++ b/tests/controller/ModelAsControllerTest.php @@ -4,6 +4,11 @@ use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Controllers\OldPageRedirector; use SilverStripe\CMS\Controllers\RootURLController; +use SilverStripe\Core\Config\Config; +use SilverStripe\Control\Director; +use SilverStripe\Control\Controller; +use SilverStripe\Dev\FunctionalTest; + /** diff --git a/tests/controller/RootURLControllerTest.php b/tests/controller/RootURLControllerTest.php index d4b85221..b9be17e4 100644 --- a/tests/controller/RootURLControllerTest.php +++ b/tests/controller/RootURLControllerTest.php @@ -2,6 +2,9 @@ use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Controllers\RootURLController; +use SilverStripe\Core\Config\Config; +use SilverStripe\Dev\SapphireTest; + /** * @package cms * @subpackage tests diff --git a/tests/controller/SilverStripeNavigatorTest.php b/tests/controller/SilverStripeNavigatorTest.php index e2212fbc..62db7280 100644 --- a/tests/controller/SilverStripeNavigatorTest.php +++ b/tests/controller/SilverStripeNavigatorTest.php @@ -4,6 +4,9 @@ use SilverStripe\Security\Member; use SilverStripe\Security\Permission; use SilverStripe\CMS\Controllers\SilverStripeNavigator; use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem; +use SilverStripe\Dev\SapphireTest; +use SilverStripe\Dev\TestOnly; + /** * @package cms diff --git a/tests/model/ErrorPageFileExtensionTest.php b/tests/model/ErrorPageFileExtensionTest.php index 7c3810ca..804f35fc 100644 --- a/tests/model/ErrorPageFileExtensionTest.php +++ b/tests/model/ErrorPageFileExtensionTest.php @@ -1,6 +1,11 @@ update('SilverStripe\\CMS\\Model\\ErrorPage', 'enable_static_file', true); - Config::inst()->update('Director', 'environment_type', 'live'); + Config::inst()->update('SilverStripe\\Control\\Director', 'environment_type', 'live'); $this->logInWithPermission('ADMIN'); } diff --git a/tests/model/FileLinkTrackingTest.php b/tests/model/FileLinkTrackingTest.php index 61bb21bf..2bba1301 100644 --- a/tests/model/FileLinkTrackingTest.php +++ b/tests/model/FileLinkTrackingTest.php @@ -3,6 +3,10 @@ use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\ORM\DataObject; use SilverStripe\CMS\Model\VirtualPage; +use SilverStripe\Assets\File; +use SilverStripe\Assets\Filesystem; +use SilverStripe\Dev\SapphireTest; + /** @@ -20,7 +24,7 @@ class FileLinkTrackingTest extends SapphireTest { $this->logInWithPermission('ADMIN'); // Write file contents - $files = File::get()->exclude('ClassName', 'Folder'); + $files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder'); foreach($files as $file) { $destPath = AssetStoreTest_SpyStore::getLocalPath($file); Filesystem::makeFolder(dirname($destPath)); @@ -30,7 +34,7 @@ class FileLinkTrackingTest extends SapphireTest { } // Since we can't hard-code IDs, manually inject image tracking shortcode - $imageID = $this->idFromFixture('Image', 'file1'); + $imageID = $this->idFromFixture('SilverStripe\\Assets\\Image', 'file1'); $page = $this->objFromFixture('Page', 'page1'); $page->Content = sprintf( '

[image src="/assets/FileLinkTrackingTest/55b443b601/testscript-test-file.jpg" id="%d"]

', @@ -66,7 +70,7 @@ class FileLinkTrackingTest extends SapphireTest { ); Versioned::set_stage(Versioned::DRAFT); - $file = $this->objFromFixture('Image', 'file1'); + $file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1'); $file->Name = 'renamed-test-file.jpg'; $file->write(); @@ -125,7 +129,7 @@ class FileLinkTrackingTest extends SapphireTest { $svp->publishRecursive(); // Rename the file - $file = $this->objFromFixture('Image', 'file1'); + $file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1'); $file->Name = 'renamed-test-file.jpg'; $file->write(); @@ -154,7 +158,7 @@ class FileLinkTrackingTest extends SapphireTest { $this->assertFalse($page->getIsModifiedOnStage()); // Rename the file - $file = $this->objFromFixture('Image', 'file1'); + $file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1'); $file->Name = 'renamed-test-file.jpg'; $file->write(); @@ -178,13 +182,13 @@ class FileLinkTrackingTest extends SapphireTest { // Rename the file twice Versioned::set_stage(Versioned::DRAFT); - $file = $this->objFromFixture('Image', 'file1'); + $file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1'); $file->Name = 'renamed-test-file.jpg'; $file->write(); // TODO Workaround for bug in DataObject->getChangedFields(), which returns stale data, // and influences File->updateFilesystem() - $file = DataObject::get_by_id('File', $file->ID); + $file = DataObject::get_by_id('SilverStripe\\Assets\\File', $file->ID); $file->Name = 'renamed-test-file-second-time.jpg'; $file->write(); $file->publishRecursive(); diff --git a/tests/model/FileLinkTrackingTest.yml b/tests/model/FileLinkTrackingTest.yml index 6c061472..983de4fd 100644 --- a/tests/model/FileLinkTrackingTest.yml +++ b/tests/model/FileLinkTrackingTest.yml @@ -1,12 +1,12 @@ # These need to come first so that SiteTree has the link meta-data written. -Image: +SilverStripe\Assets\Image: file1: FileFilename: testscript-test-file.jpg FileHash: 55b443b60176235ef09801153cca4e6da7494a0c Name: testscript-test-file.jpg -Page: +Page: page1: Title: page1 URLSegment: page1 - # Content is set via test setup \ No newline at end of file + # Content is set via test setup diff --git a/tests/model/RedirectorPageTest.php b/tests/model/RedirectorPageTest.php index 41ee7e54..75b7780a 100644 --- a/tests/model/RedirectorPageTest.php +++ b/tests/model/RedirectorPageTest.php @@ -2,6 +2,11 @@ use SilverStripe\CMS\Model\RedirectorPage; use SilverStripe\CMS\Model\RedirectorPage_Controller; +use SilverStripe\Control\Director; +use SilverStripe\Dev\FunctionalTest; +use SilverStripe\Core\Extension; +use SilverStripe\Dev\TestOnly; + class RedirectorPageTest extends FunctionalTest { protected static $fixture_file = 'RedirectorPageTest.yml'; diff --git a/tests/model/SiteTreeActionsTest.php b/tests/model/SiteTreeActionsTest.php index 12a72454..44833394 100644 --- a/tests/model/SiteTreeActionsTest.php +++ b/tests/model/SiteTreeActionsTest.php @@ -3,6 +3,9 @@ use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\ORM\DB; use SilverStripe\Security\Permission; +use SilverStripe\Dev\FunctionalTest; +use SilverStripe\Dev\TestOnly; + /** * Possible actions: diff --git a/tests/model/SiteTreeBacklinksTest.php b/tests/model/SiteTreeBacklinksTest.php index 7dbab0f6..98ad52ba 100644 --- a/tests/model/SiteTreeBacklinksTest.php +++ b/tests/model/SiteTreeBacklinksTest.php @@ -2,6 +2,13 @@ use SilverStripe\ORM\Versioning\Versioned; use SilverStripe\ORM\DataExtension; +use SilverStripe\Control\HTTP; +use SilverStripe\Control\Director; +use SilverStripe\Dev\SapphireTest; +use SilverStripe\Forms\FieldList; +use SilverStripe\Forms\HTMLEditor\HTMLEditorField; +use SilverStripe\Dev\TestOnly; + /** * Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking diff --git a/tests/model/SiteTreeBrokenLinksTest.php b/tests/model/SiteTreeBrokenLinksTest.php index d9cc8be8..311efa24 100644 --- a/tests/model/SiteTreeBrokenLinksTest.php +++ b/tests/model/SiteTreeBrokenLinksTest.php @@ -5,6 +5,9 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\CMS\Model\VirtualPage; use SilverStripe\CMS\Model\RedirectorPage; +use SilverStripe\Assets\File; +use SilverStripe\Dev\SapphireTest; + /** diff --git a/tests/model/SiteTreeHTMLEditorFieldTest.php b/tests/model/SiteTreeHTMLEditorFieldTest.php index 3f9ad877..bdff016a 100644 --- a/tests/model/SiteTreeHTMLEditorFieldTest.php +++ b/tests/model/SiteTreeHTMLEditorFieldTest.php @@ -1,6 +1,12 @@ logInWithPermission('ADMIN'); // Write file contents - $files = File::get()->exclude('ClassName', 'Folder'); + $files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder'); foreach($files as $file) { $destPath = AssetStoreTest_SpyStore::getLocalPath($file); Filesystem::makeFolder(dirname($destPath)); @@ -67,7 +73,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest { public function testFileLinkTracking() { $sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home'); $editor = new HTMLEditorField('Content'); - $fileID = $this->idFromFixture('File', 'example_file'); + $fileID = $this->idFromFixture('SilverStripe\\Assets\\File', 'example_file'); $editor->setValue(sprintf( '

Example File

', @@ -124,7 +130,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest { public function testImageTracking() { $sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home'); $editor = new HTMLEditorField('Content'); - $file = $this->objFromFixture('Image', 'example_image'); + $file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'example_image'); $editor->setValue(sprintf('[image src="%s" id="%d"]', $file->getURL(), $file->ID)); $editor->saveInto($sitetree); @@ -181,7 +187,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest { $editor->setValue(sprintf ( '

Working Link

', - $this->idFromFixture('File', 'example_file') + $this->idFromFixture('SilverStripe\\Assets\\File', 'example_file') )); $sitetree->HasBrokenFile = false; $editor->saveInto($sitetree); diff --git a/tests/model/SiteTreeHTMLEditorFieldTest.yml b/tests/model/SiteTreeHTMLEditorFieldTest.yml index d6372dd9..efe29582 100644 --- a/tests/model/SiteTreeHTMLEditorFieldTest.yml +++ b/tests/model/SiteTreeHTMLEditorFieldTest.yml @@ -6,13 +6,13 @@ SilverStripe\CMS\Model\SiteTree: contact: Title: Contact Us -File: +SilverStripe\Assets\File: example_file: FileFilename: example.pdf FileHash: 55b443b60176235ef09801153cca4e6da7494a0c Name: example.pdf -Image: +SilverStripe\Assets\Image: example_image: FileFilename: example.jpg FileHash: 55b443b60176235ef09801153cca4e6da7494a0c diff --git a/tests/model/SiteTreeLinkTrackingTest.php b/tests/model/SiteTreeLinkTrackingTest.php index bd16291d..88032373 100644 --- a/tests/model/SiteTreeLinkTrackingTest.php +++ b/tests/model/SiteTreeLinkTrackingTest.php @@ -1,6 +1,10 @@ objFromFixture('Page', 'inheritWithNoParent'); - $siteconfig = $this->objFromFixture('SiteConfig', 'default'); + $siteconfig = $this->objFromFixture('SilverStripe\\SiteConfig\\SiteConfig', 'default'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'editor'); $editorGroup = $this->objFromFixture('SilverStripe\\Security\\Group', 'editorgroup'); @@ -430,7 +434,7 @@ class SiteTreePermissionsTest extends FunctionalTest { public function testInheritCanEditFromSiteConfig() { $page = $this->objFromFixture('Page', 'inheritWithNoParent'); - $siteconfig = $this->objFromFixture('SiteConfig', 'default'); + $siteconfig = $this->objFromFixture('SilverStripe\\SiteConfig\\SiteConfig', 'default'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'editor'); $user = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser'); $editorGroup = $this->objFromFixture('SilverStripe\\Security\\Group', 'editorgroup'); diff --git a/tests/model/SiteTreePermissionsTest.yml b/tests/model/SiteTreePermissionsTest.yml index c573a330..06faa371 100644 --- a/tests/model/SiteTreePermissionsTest.yml +++ b/tests/model/SiteTreePermissionsTest.yml @@ -1,4 +1,4 @@ -SiteConfig: +SilverStripe\SiteConfig\SiteConfig: default: Title: My test site Tagline: There is no doubt this is a great test site diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index f2b0fecc..21c6f2b9 100644 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -11,6 +11,17 @@ use SilverStripe\Security\Permission; use SilverStripe\Security\Group; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTreeExtension; +use SilverStripe\Core\Config\Config; +use SilverStripe\SiteConfig\SiteConfig; +use SilverStripe\Control\Session; +use SilverStripe\View\Parsers\ShortcodeParser; +use SilverStripe\Control\Director; +use SilverStripe\i18n\i18n; +use SilverStripe\Dev\SapphireTest; +use SilverStripe\Dev\TestOnly; +use SilverStripe\View\Parsers\HTMLCleaner; +use SilverStripe\View\Parsers\Diff; + /** @@ -81,7 +92,7 @@ class SiteTreeTest extends SapphireTest { 'product3' => 'another-product-2', 'product4' => 'another-product-3', 'object' => 'object', - 'controller' => 'controller-2', + 'controller' => 'controller', 'numericonly' => '1930', ); @@ -806,7 +817,7 @@ class SiteTreeTest extends SapphireTest { */ public function testValidURLSegmentClassNameConflicts() { $sitetree = new SiteTree(); - $sitetree->URLSegment = 'Controller'; + $sitetree->URLSegment = 'SilverStripe\\Control\\Controller'; $this->assertFalse($sitetree->validURLSegment(), 'Class name conflicts are recognised'); } @@ -846,8 +857,8 @@ class SiteTreeTest extends SapphireTest { } public function testURLSegmentMultiByte() { - $origAllow = Config::inst()->get('URLSegmentFilter', 'default_allow_multibyte'); - Config::inst()->update('URLSegmentFilter', 'default_allow_multibyte', true); + $origAllow = Config::inst()->get('SilverStripe\\View\\Parsers\\URLSegmentFilter', 'default_allow_multibyte'); + Config::inst()->update('SilverStripe\\View\\Parsers\\URLSegmentFilter', 'default_allow_multibyte', true); $sitetree = new SiteTree(); $sitetree->write(); @@ -862,7 +873,7 @@ class SiteTreeTest extends SapphireTest { $sitetreeLive = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', '"SiteTree"."ID" = ' .$sitetree->ID, false); $this->assertEquals($sitetreeLive->URLSegment, rawurlencode('brötchen')); - Config::inst()->update('URLSegmentFilter', 'default_allow_multibyte', $origAllow); + Config::inst()->update('SilverStripe\\View\\Parsers\\URLSegmentFilter', 'default_allow_multibyte', $origAllow); } public function testVersionsAreCreated() { @@ -1134,7 +1145,7 @@ class SiteTreeTest extends SapphireTest { // Test with title $meta = $page->MetaTags(); - $charset = Config::inst()->get('ContentNegotiator', 'encoding'); + $charset = Config::inst()->get('SilverStripe\\Control\\ContentNegotiator', 'encoding'); $this->assertContains('assertContains('assertContains('mockController, 'SilverStripe\\CMS\\Search\\SearchForm'); - $dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile'); + $dontShowInSearchFile = $this->objFromFixture('SilverStripe\\Assets\\File', 'dontShowInSearchFile'); $dontShowInSearchFile->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); - $showInSearchFile = $this->objFromFixture('File', 'showInSearchFile'); + $showInSearchFile = $this->objFromFixture('SilverStripe\\Assets\\File', 'showInSearchFile'); $showInSearchFile->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $results = $sf->getResults(null, array('Search'=>'dontShowInSearchFile')); diff --git a/tests/search/SearchFormTest.yml b/tests/search/SearchFormTest.yml index d0838f97..b5e57525 100644 --- a/tests/search/SearchFormTest.yml +++ b/tests/search/SearchFormTest.yml @@ -34,7 +34,7 @@ SilverStripe\CMS\Model\SiteTree: pageWithSpecialChars: Title: Brötchen Content: Frisch vom Bäcker -File: +SilverStripe\Assets\File: showInSearchFile: Title: showInSearchFile ShowInSearch: 1 diff --git a/tests/tasks/MigrateSiteTreeLinkingTaskTest.php b/tests/tasks/MigrateSiteTreeLinkingTaskTest.php index 2db39f6d..99c32f77 100644 --- a/tests/tasks/MigrateSiteTreeLinkingTaskTest.php +++ b/tests/tasks/MigrateSiteTreeLinkingTaskTest.php @@ -2,6 +2,8 @@ use SilverStripe\ORM\DataObject; use SilverStripe\CMS\Tasks\MigrateSiteTreeLinkingTask; +use SilverStripe\Dev\SapphireTest; + /** diff --git a/tests/tasks/RemoveOrphanedPagesTaskTest.php b/tests/tasks/RemoveOrphanedPagesTaskTest.php index 474d282f..cef05259 100644 --- a/tests/tasks/RemoveOrphanedPagesTaskTest.php +++ b/tests/tasks/RemoveOrphanedPagesTaskTest.php @@ -1,6 +1,8 @@ Fixture tree