Merge pull request #1602 from open-sausages/pulls/4.0/namespace-everything

Upgrade code for framework namespaces
This commit is contained in:
Ingo Schommer 2016-09-08 17:44:45 +12:00 committed by GitHub
commit ac954095ab
103 changed files with 561 additions and 611 deletions

View File

@ -1,6 +1,9 @@
<?php
use SilverStripe\Admin\CMSMenu;
use SilverStripe\View\Parsers\ShortcodeParser;
use SilverStripe\Assets\File;
/**
* - CMS_DIR: Path relative to webroot, e.g. "cms"

View File

@ -4,6 +4,6 @@ After: '#live-logging'
Except:
environment: dev
---
Injector:
SilverStripe\Core\Injector\Injector:
FriendlyErrorFormatter:
class: SilverStripe\CMS\Logging\ErrorPageErrorFormatter

View File

@ -1,12 +1,12 @@
SilverStripe\Admin\LeftAndMain:
extensions:
- SilverStripe\CMS\Controllers\LeftAndMainPageIconsExtension
Controller:
SilverStripe\Control\Controller:
extensions:
- SilverStripe\CMS\Controllers\ErrorPageControllerExtension
Form:
SilverStripe\Forms\Form:
extensions:
- SilverStripe\CMS\Controllers\ErrorPageControllerExtension
File:
SilverStripe\Assets\File:
extensions:
- SilverStripe\CMS\Controllers\ErrorPageFileExtension

View File

@ -3,6 +3,6 @@ Name: cmsi18n
Before: '/i18n'
After: '/i18n#basei18n'
---
i18n:
SilverStripe\i18n\i18n:
module_priority:
- cms

View File

@ -1,6 +1,6 @@
---
Name: cmsinjector
---
Injector:
SilverStripe\Core\Injector\Injector:
SiteTreeLinkTracking_Parser:
class: SilverStripe\CMS\Model\SiteTreeLinkTracking_Parser

View File

@ -3,7 +3,7 @@ Name: modelascontrollerroutes
Before: '*'
After: '#rootroutes'
---
Director:
SilverStripe\Control\Director:
rules:
'': 'SilverStripe\CMS\Controllers\RootURLController'
'RemoveOrphanedPagesTask//$Action/$ID/$OtherID': 'SilverStripe\CMS\Tasks\RemoveOrphanedPagesTask'
@ -13,6 +13,6 @@ Director:
Name: legacycmsroutes
After: '#adminroutes'
---
Director:
SilverStripe\Control\Director:
rules:
'admin/cms': '->admin/pages'

View File

@ -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
{

View File

@ -8,9 +8,6 @@ use SilverStripe\Admin\CMSBatchAction;
/**
* Delete items batch action.
*
* @package cms
* @subpackage batchaction
*/
class CMSBatchAction_Delete extends CMSBatchAction {
public function getActionTitle() {

View File

@ -7,9 +7,6 @@ use SilverStripe\ORM\SS_List;
/**
* Publish items batch action.
*
* @package cms
* @subpackage batchaction
*/
class CMSBatchAction_Publish extends CMSBatchAction
{

View File

@ -11,8 +11,6 @@ use SilverStripe\Security\Permission;
/**
* Batch restore of pages
* @package cms
* @subpackage batchaction
*/
class CMSBatchAction_Restore extends CMSBatchAction
{

View File

@ -7,9 +7,6 @@ use SilverStripe\ORM\SS_List;
/**
* Unpublish items batch action.
*
* @package cms
* @subpackage batchaction
*/
class CMSBatchAction_Unpublish extends CMSBatchAction
{

View File

@ -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;

View File

@ -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'));

View File

@ -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;
}
/**

View File

@ -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"
);

View File

@ -2,9 +2,6 @@
namespace SilverStripe\CMS\Controllers;
/**
* @package cms
*/
class CMSPageSettingsController extends CMSMain {
private static $url_segment = 'pages/settings';

View File

@ -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';

View File

@ -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 {

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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);

View File

@ -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);

View File

@ -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 {

View File

@ -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))) {

View File

@ -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 {

View File

@ -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 {
/**

View File

@ -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 {

View File

@ -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;
}
/**

View File

@ -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 */

View File

@ -1,14 +1,10 @@
<?php
namespace SilverStripe\CMS\Controllers;
use Controller;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller;
/**
* @package cms
* @subpackage content
*/
class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem
{
/** @config */

View File

@ -1,14 +1,10 @@
<?php
namespace SilverStripe\CMS\Controllers;
use Controller;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\Versioning\Versioned;
/**
* @package cms
* @subpackage content
*/
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
{
/** @config */

View File

@ -1,16 +1,12 @@
<?php
namespace SilverStripe\CMS\Controllers;
use ClassInfo;
use Controller;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller;
use SilverStripe\Core\ClassInfo;
use SilverStripe\ORM\Versioning\Versioned;
use SiteTreeFutureState;
/**
* @package cms
* @subpackage content
*/
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem
{
/** @config */

View File

@ -3,20 +3,17 @@
namespace SilverStripe\CMS\Forms;
use SilverStripe\CMS\Model\SiteTree;
use SS_HTTPRequest;
use TextField;
use Requirements;
use Controller;
use Convert;
use SilverStripe\Control\Controller;
use SilverStripe\Control\SS_HTTPRequest;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\TextField;
use SilverStripe\View\Requirements;
/**
* Used to edit the SiteTree->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 {

View File

@ -1,11 +1,9 @@
<?php
namespace SilverStripe\CMS\Forms;
/**
* Readonly version of a site tree URL segment field
*
* @package forms
* @subpackage fields-basic
*/
class SiteTreeURLSegmentField_Readonly extends SiteTreeURLSegmentField
{

View File

@ -2,8 +2,9 @@
namespace SilverStripe\CMS\Logging;
use SilverStripe\Framework\Logging\DebugViewFriendlyErrorFormatter;
use SilverStripe\CMS\Model\ErrorPage;
use SilverStripe\Control\Director;
use SilverStripe\Logging\DebugViewFriendlyErrorFormatter;
/**
* Provides {@see ErrorPage}-gnostic error handling
@ -12,7 +13,7 @@ class ErrorPageErrorFormatter extends DebugViewFriendlyErrorFormatter {
public function output($statusCode) {
// Ajax content is plain-text only
if(\Director::is_ajax()) {
if(Director::is_ajax()) {
return $this->getTitle();
}

View File

@ -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 {

View File

@ -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();

View File

@ -1,15 +1,14 @@
<?php
namespace SilverStripe\CMS\Model;
use Page_Controller;
use SilverStripe\ORM\DataModel;
use SS_HTTPRequest;
use SS_HTTPResponse;
use SilverStripe\Control\SS_HTTPRequest;
use SilverStripe\Control\SS_HTTPResponse;
use Page_Controller;
/**
* Controller for ErrorPages.
*
* @package cms
*/
class ErrorPage_Controller extends Page_Controller
{

View File

@ -2,20 +2,16 @@
namespace SilverStripe\CMS\Model;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\View\Requirements;
use Page;
use Requirements;
use HeaderField;
use OptionsetField;
use TreeDropdownField;
use TextField;
use Page_Controller;
/**
* A redirector page redirects when the page is visited.
*
* @package cms
* @subpackage content
*
* @property string $RedirectionType Either 'Internal' or 'External'
* @property string $ExternalURL URL to redirect to if $RedirectionType is 'External'
* @property int $LinkToID

View File

@ -5,8 +5,6 @@ use Page_Controller;
/**
* Controller for the {@link RedirectorPage}.
* @package cms
* @subpackage content
*/
class RedirectorPage_Controller extends Page_Controller
{

View File

@ -2,60 +2,59 @@
namespace SilverStripe\CMS\Model;
use GridFieldDataColumns;
use ShortcodeParser;
use Page;
use SilverStripe\Admin\AddToCampaignHandler_FormAction;
use SilverStripe\Admin\CMSPreviewable;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Controllers\ModelAsController;
use SilverStripe\CMS\Controllers\RootURLController;
use SilverStripe\CMS\Forms\SiteTreeURLSegmentField;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldGroup;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\FormField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet;
use SilverStripe\Forms\TextareaField;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\ToggleCompositeField;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\i18n\i18n;
use SilverStripe\i18n\i18nEntityProvider;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\HiddenClass;
use SilverStripe\ORM\Hierarchy\Hierarchy;
use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\HiddenClass;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Security\Group;
use SilverStripe\Security\PermissionProvider;
use i18nEntityProvider;
use Director;
use SilverStripe\CMS\Controllers\RootURLController;
use ClassInfo;
use Convert;
use Controller;
use Deprecation;
use SSViewer;
use ArrayData;
use SiteConfig;
use FormField;
use Config;
use Page;
use URLSegmentFilter;
use SilverStripe\CMS\Controllers\ModelAsController;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\View\ArrayData;
use SilverStripe\View\Parsers\ShortcodeParser;
use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\View\SSViewer;
use Subsite;
use LiteralField;
use GridField;
use SilverStripe\CMS\Forms\SiteTreeURLSegmentField;
use FieldList;
use TabSet;
use Tab;
use TextField;
use HTMLEditorField;
use ToggleCompositeField;
use TextareaField;
use DropdownField;
use CompositeField;
use OptionsetField;
use TreeDropdownField;
use FieldGroup;
use CheckboxField;
use ListboxField;
use FormAction;
use i18n;
use SilverStripe\Admin\AddToCampaignHandler_FormAction;
use SilverStripe\Admin\CMSPreviewable;
/**
* Basic data-object representing all pages within the site tree. All page types that live within the hierarchy should
@ -89,8 +88,6 @@ use SilverStripe\Admin\CMSPreviewable;
* @mixin Hierarchy
* @mixin Versioned
* @mixin SiteTreeLinkTracking
*
* @package cms
*/
class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvider,CMSPreviewable {
@ -251,8 +248,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
private static $description = 'Generic content page';
private static $extensions = array(
'SilverStripe\ORM\Hierarchy\Hierarchy',
'SilverStripe\ORM\Versioning\Versioned',
'SilverStripe\\ORM\\Hierarchy\\Hierarchy',
'SilverStripe\\ORM\\Versioning\\Versioned',
"SilverStripe\\CMS\\Model\\SiteTreeLinkTracking"
);
@ -1458,7 +1455,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
));
}
$charset = Config::inst()->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 ? '<br />' : '';
$helpText .= _t('SiteTreeURLSegmentField.HelpChars', ' Special characters are automatically converted or removed.');
}
@ -2036,12 +2033,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
. "</p>"), "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));

View File

@ -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 {

View File

@ -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 {

View File

@ -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
}
}

View File

@ -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(

View File

@ -1,9 +1,9 @@
<?php
namespace SilverStripe\CMS\Model;
use Director;
use SilverStripe\Control\Director;
use SilverStripe\ORM\DataObject;
use SS_HTMLValue;
use SilverStripe\View\Parsers\SS_HTMLValue;
/**
* A helper object for extracting information about links.
@ -27,6 +27,7 @@ class SiteTreeLinkTracking_Parser
{
$results = array();
// @todo - Should be calling getElementsByTagName on DOMDocument?
$links = $htmlValue->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)
);
}
}

View File

@ -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';

View File

@ -1,14 +1,13 @@
<?php
namespace SilverStripe\CMS\Model;
use Exception;
use Page_Controller;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Controllers\ModelAsController;
use Exception;
use Page_Controller;
/**
* Controller for the virtual page.
* @package cms
*/
class VirtualPage_Controller extends Page_Controller
{
@ -50,8 +49,11 @@ class VirtualPage_Controller extends Page_Controller
public function getViewer($action)
{
$controller = $this->getVirtualisedController() ?: $this;
return $controller->getViewer($action);
$controller = $this->getVirtualisedController();
if($controller) {
return $controller->getViewer($action);
}
return parent::getViewer($action);
}
/**

View File

@ -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() {

View File

@ -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 <a href="%s">%s</a>',

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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(

View File

@ -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;
}
/**

View File

@ -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.';

View File

@ -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 (<firstname>@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:<br />
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:<br />
$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:<br />
$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:<br />
$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:<br />
$stageRecord->destroy();
//unset($stageRecord);
}
/** @var SiteTree $liveRecord */
$liveRecord = Versioned::get_one_by_stage(
$this->orphanedSearchClass,
'Live',
@ -307,7 +302,9 @@ in the other stage:<br />
$liveRecord->ShowInMenus = 0;
$liveRecord->ShowInSearch = 0;
$liveRecord->write();
if(!$stageRecord) $liveRecord->doRestoreToStage();
if(!$stageRecord) {
$liveRecord->doRestoreToStage();
}
$liveRecord->doUnpublish();
$liveRecord->destroy();
unset($liveRecord);

View File

@ -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, '/');
}
}

View File

@ -1,26 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<% base_tag %>
<title>Print</title>
</head>
<%-- <body onload="window.print();"> --%>
<body>
<% with $Form.Controller %>
<h1 style="margin-bottom: 0">$CurrentReport.Title</h1>
<% with $CurrentReport.getCmsFields %>
<% if $Name == Filters %>
<h2 style="margin-bottom: 0; margin-top: 0;">Filters</h2>
<ul style="margin-top: 0">
<% loop $FieldSet %>
<li>$Title = $performReadonlyTransformation.Field</li>
<% end_loop %>
</ul>
<% end_if %>
<% end_with %>
<% end_with %>
<% include TableListField %>
</body>
</html>

View File

@ -0,0 +1,15 @@
<form $FormAttributes>
<% if $Message %>
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
<% else %>
<p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
<% end_if %>
<fieldset>
<% loop $Fields %>
$FieldHolder
<% end_loop %>
<% loop $Actions %>
$Field
<% end_loop %>
</fieldset>
</form>

View File

@ -1,10 +0,0 @@
&nbsp; &nbsp;
<a id="SilverStripeNavigatorLink" href="#">
<% _t('SilverStripeNavigatorLink.ShareLink','Share link') %>
</a>
<div id="SilverStripeNavigatorLinkPopup">
<a class="close"><% _t('SilverStripeNavigatorLinkl.CloseLink','Close') %></a>
<p>
<% _t('SilverStripeNavigatorLink.ShareInstructions','To share this page, copy and paste the link below.') %></p>
<input value="$Link" />
</div>

View File

@ -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);

View File

@ -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;
/**

View File

@ -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();

View File

@ -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:

View File

@ -2,6 +2,8 @@
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\CMS\Controllers\CMSPageHistoryController;
use SilverStripe\Dev\FunctionalTest;
/**

View File

@ -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 {

View File

@ -1,6 +1,10 @@
<?php
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\Control\SS_HTTPResponse_Exception;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest;
/**
* @package cms

View File

@ -2,6 +2,11 @@
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\ORM\Search\FulltextSearchable;
use SilverStripe\Core\Config\Config;
use SilverStripe\Assets\File;
use SilverStripe\Dev\SapphireTest;
class ContentControllerSearchExtensionTest extends SapphireTest {
@ -15,13 +20,13 @@ class ContentControllerSearchExtensionTest extends SapphireTest {
$controller = new ContentController($page);
$form = $controller->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');
}
}

View File

@ -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

View File

@ -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;
/**

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,11 @@
<?php
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\Assets\File;
use SilverStripe\Control\Session;
use SilverStripe\View\Parsers\ShortcodeParser;
use SilverStripe\Dev\SapphireTest;
class ErrorPageFileExtensionTest extends SapphireTest {

View File

@ -2,6 +2,9 @@
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\CMS\Model\ErrorPage;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest;
/**
@ -24,7 +27,7 @@ class ErrorPageTest extends FunctionalTest {
// Set temporary asset backend store
AssetStoreTest_SpyStore::activate('ErrorPageTest');
Config::inst()->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');
}

View File

@ -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(
'<p>[image src="/assets/FileLinkTrackingTest/55b443b601/testscript-test-file.jpg" id="%d"]</p>',
@ -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();

View File

@ -1,5 +1,5 @@
# 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

View File

@ -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';

View File

@ -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:

View File

@ -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

View File

@ -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;
/**

View File

@ -1,6 +1,12 @@
<?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Assets\File;
use SilverStripe\Assets\Filesystem;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Dev\CSSContentParser;
use SilverStripe\Dev\FunctionalTest;
class SiteTreeHTMLEditorFieldTest extends FunctionalTest {
protected static $fixture_file = 'SiteTreeHTMLEditorFieldTest.yml';
@ -12,7 +18,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest {
$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));
@ -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(
'<p><a href="[file_link,id=%d]">Example File</a></p>',
@ -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 (
'<p><a href="[file_link,id=%d]">Working Link</a></p>',
$this->idFromFixture('File', 'example_file')
$this->idFromFixture('SilverStripe\\Assets\\File', 'example_file')
));
$sitetree->HasBrokenFile = false;
$editor->saveInto($sitetree);

View File

@ -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

View File

@ -1,6 +1,10 @@
<?php
use SilverStripe\CMS\Model\SiteTreeLinkTracking_Parser;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Assets\File;
use SilverStripe\Dev\SapphireTest;
class SiteTreeLinkTrackingTest extends SapphireTest {

View File

@ -3,6 +3,10 @@
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\Security\Member;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\SS_HTTPResponse_Exception;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest;
/**
@ -405,7 +409,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
public function testInheritCanViewFromSiteConfig() {
$page = $this->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');

View File

@ -1,4 +1,4 @@
SiteConfig:
SilverStripe\SiteConfig\SiteConfig:
default:
Title: My test site
Tagline: There is no doubt this is a great test site

View File

@ -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('<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'"', $meta);
$this->assertContains('<meta name="description" content="The &lt;br /&gt; and &lt;br&gt; tags"', $meta);
$this->assertContains('<link rel="canonical" href="http://www.mysite.com/html-and-xml"', $meta);

View File

@ -1,4 +1,4 @@
SiteConfig:
SilverStripe\SiteConfig\SiteConfig:
default:
Title: My test site
Tagline: Default site config

View File

@ -11,6 +11,10 @@ use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Controllers\ModelAsController;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Dev\TestOnly;

View File

@ -9,6 +9,10 @@ use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\CMS\Reports\BrokenVirtualPagesReport;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Reports\BrokenRedirectorPagesReport;
use SilverStripe\Reports\SS_Report;
use SilverStripe\Assets\File;
use SilverStripe\Dev\SapphireTest;
/**

View File

@ -1,4 +1,6 @@
<?php
use SilverStripe\Dev\FunctionalTest;
class CMSMainSearchFormTest extends FunctionalTest {
protected static $fixture_file = '../controller/CMSMainTest.yml';

View File

@ -6,6 +6,9 @@ use SilverStripe\MSSQL\MSSQLDatabase;
use SilverStripe\PostgreSQL\PostgreSQLDatabase;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Search\SearchForm;
use SilverStripe\ORM\Search\FulltextSearchable;
use SilverStripe\Dev\FunctionalTest;
@ -234,9 +237,9 @@ class ZZZSearchFormTest extends FunctionalTest {
$sf = new SearchForm($this->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'));

View File

@ -34,7 +34,7 @@ SilverStripe\CMS\Model\SiteTree:
pageWithSpecialChars:
Title: Brötchen
Content: Frisch vom B&auml;cker
File:
SilverStripe\Assets\File:
showInSearchFile:
Title: showInSearchFile
ShowInSearch: 1

View File

@ -2,6 +2,8 @@
use SilverStripe\ORM\DataObject;
use SilverStripe\CMS\Tasks\MigrateSiteTreeLinkingTask;
use SilverStripe\Dev\SapphireTest;
/**

View File

@ -1,6 +1,8 @@
<?php
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\Dev\FunctionalTest;
/**
* <h2>Fixture tree</h2>