mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Apply SilverStripe\Admin namespace
This commit is contained in:
parent
bbb2824f3a
commit
db34e011f3
20
.upgrade.yml
20
.upgrade.yml
@ -154,6 +154,26 @@ mappings:
|
||||
Security: SilverStripe\Security\Security
|
||||
SecurityToken: SilverStripe\Security\SecurityToken
|
||||
NullSecurityToken: SilverStripe\Security\NullSecurityToken
|
||||
AddToCampaignHandler: SilverStripe\Admin\AddToCampaignHandler
|
||||
AddToCampaignHandler_FormAction: SilverStripe\Admin\AddToCampaignHandler_FormAction
|
||||
AdminRootController: SilverStripe\Admin\AdminRootController
|
||||
CampaignAdmin: SilverStripe\Admin\CampaignAdmin
|
||||
CMSBatchAction: SilverStripe\Admin\CMSBatchAction
|
||||
CMSBatchActionHandler: SilverStripe\Admin\CMSBatchActionHandler
|
||||
CMSMenu: SilverStripe\Admin\CMSMenu
|
||||
CMSMenuItem: SilverStripe\Admin\CMSMenuItem
|
||||
CMSPreviewable: SilverStripe\Admin\CMSPreviewable
|
||||
CMSProfileController: SilverStripe\Admin\CMSProfileController
|
||||
GroupImportForm: SilverStripe\Admin\GroupImportForm
|
||||
LeftAndMain: SilverStripe\Admin\LeftAndMain
|
||||
LeftAndMainMarkingFilter: SilverStripe\Admin\LeftAndMainMarkingFilter
|
||||
LeftAndMain_HTTPResponse: SilverStripe\Admin\LeftAndMain_HTTPResponse
|
||||
LeftAndMain_TreeNode: SilverStripe\Admin\LeftAndMain_TreeNode
|
||||
LeftAndMain_SearchFilter: SilverStripe\Admin\LeftAndMain_SearchFilter
|
||||
LeftAndMainExtension: SilverStripe\Admin\LeftAndMainExtension
|
||||
MemberImportForm: SilverStripe\Admin\MemberImportForm
|
||||
ModelAdmin: SilverStripe\Admin\ModelAdmin
|
||||
SecurityAdmin: SilverStripe\Admin\SecurityAdmin
|
||||
skipConfigs:
|
||||
- db
|
||||
- casting
|
||||
|
@ -5,13 +5,15 @@ namespace SilverStripe\ORM\Hierarchy;
|
||||
use Config;
|
||||
use Exception;
|
||||
use Controller;
|
||||
use LeftAndMain;
|
||||
|
||||
use ClassInfo;
|
||||
use SilverStripe\ORM\ValidationResult;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\ORM\Versioning\Versioned;
|
||||
use SilverStripe\Admin\LeftAndMain;
|
||||
|
||||
|
||||
/**
|
||||
* DataObjects that use the Hierarchy extension can be be organised as a hierarchy, with children and parents. The most
|
||||
|
@ -6,7 +6,7 @@ use Exception;
|
||||
use BadMethodCallException;
|
||||
|
||||
|
||||
use CMSPreviewable;
|
||||
|
||||
use Controller;
|
||||
use SilverStripe\Filesystem\Thumbnail;
|
||||
use SilverStripe\ORM\DataList;
|
||||
@ -15,6 +15,8 @@ use SilverStripe\ORM\ManyManyList;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Admin\CMSPreviewable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -7,8 +7,10 @@ use Controller;
|
||||
use Director;
|
||||
use Convert;
|
||||
use Session;
|
||||
use AdminRootController;
|
||||
|
||||
use SS_HTTPResponse;
|
||||
use SilverStripe\Admin\AdminRootController;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,7 @@ class Group extends DataObject {
|
||||
|
||||
// Filter permissions
|
||||
// TODO SecurityAdmin coupling, not easy to get to the form fields through GridFieldDetailForm
|
||||
$permissionsField->setHiddenPermissions((array)Config::inst()->get('SecurityAdmin', 'hidden_permissions'));
|
||||
$permissionsField->setHiddenPermissions((array)Config::inst()->get('SilverStripe\\Admin\\SecurityAdmin', 'hidden_permissions'));
|
||||
|
||||
if($this->ID) {
|
||||
$group = $this;
|
||||
@ -203,7 +203,7 @@ class Group extends DataObject {
|
||||
) . '<br />' .
|
||||
sprintf(
|
||||
'<a href="%s" class="add-role">%s</a>',
|
||||
singleton('SecurityAdmin')->Link('show/root#Root_Roles'),
|
||||
singleton('SilverStripe\\Admin\\SecurityAdmin')->Link('show/root#Root_Roles'),
|
||||
// TODO This should include #Root_Roles to switch directly to the tab,
|
||||
// but tabstrip.js doesn't display tabs when directly adressed through a URL pragma
|
||||
_t('Group.RolesAddEditLink', 'Manage roles')
|
||||
|
@ -1351,7 +1351,7 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
if(class_exists('SilverStripe\\CMS\\Controllers\\CMSMain')) {
|
||||
$cmsPerms = CMSMain::singleton()->providePermissions();
|
||||
} else {
|
||||
$cmsPerms = singleton('LeftAndMain')->providePermissions();
|
||||
$cmsPerms = singleton('SilverStripe\\Admin\\LeftAndMain')->providePermissions();
|
||||
}
|
||||
|
||||
if(!empty($cmsPerms)) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Admin\CMSMenu;
|
||||
|
||||
// Default CMS HTMLEditorConfig
|
||||
HTMLEditorConfig::get('cms')->setOptions(array(
|
||||
'friendly_name' => 'Default CMS',
|
||||
@ -35,4 +37,4 @@ HTMLEditorConfig::get('cms')
|
||||
'ssbuttons' => FRAMEWORK_DIR . '/client/dist/js/TinyMCE_SSPlugin.js'
|
||||
));
|
||||
|
||||
CMSMenu::remove_menu_class('CMSProfileController');
|
||||
CMSMenu::remove_menu_class('SilverStripe\\Admin\\CMSProfileController');
|
||||
|
@ -1,10 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\Framework\Core\Injectable;
|
||||
|
||||
use SilverStripe\ORM\Versioning\ChangeSet;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\Versioning\ChangeSetItem;
|
||||
use ClassInfo;
|
||||
use Object;
|
||||
use DropdownField;
|
||||
use FieldList;
|
||||
use HiddenField;
|
||||
use Form;
|
||||
use CompositeField;
|
||||
use LiteralField;
|
||||
use Director;
|
||||
use SS_HTTPResponse;
|
||||
use FormAction;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\ORM\DataModel;
|
||||
use Controller;
|
||||
use TemplateGlobalProvider;
|
||||
use Config;
|
||||
use SS_HTTPRequest;
|
||||
use Injector;
|
||||
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
@ -43,7 +52,7 @@ class AdminRootController extends Controller implements TemplateGlobalProvider {
|
||||
* The LeftAndMain child that will be used as the initial panel to display if none is selected (i.e. if you
|
||||
* visit /admin)
|
||||
*/
|
||||
private static $default_panel = 'SecurityAdmin';
|
||||
private static $default_panel = 'SilverStripe\\Admin\\SecurityAdmin';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@ -1,8 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\Versioning\Versioned;
|
||||
use Object;
|
||||
use Controller;
|
||||
use Convert;
|
||||
|
||||
|
||||
/**
|
||||
* A class representing back actions.
|
||||
|
@ -1,11 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\ORM\Versioning\Versioned;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Security\SecurityToken;
|
||||
use RequestHandler;
|
||||
use Config;
|
||||
use Controller;
|
||||
use SS_HTTPResponse;
|
||||
use InvalidArgumentException;
|
||||
use ArrayData;
|
||||
use Translatable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -73,9 +84,9 @@ class CMSBatchActionHandler extends RequestHandler {
|
||||
* @param string $recordClass
|
||||
*/
|
||||
public static function register($urlSegment, $batchActionClass, $recordClass = 'SilverStripe\\CMS\\Model\\SiteTree') {
|
||||
if(is_subclass_of($batchActionClass, 'CMSBatchAction')) {
|
||||
if(is_subclass_of($batchActionClass, 'SilverStripe\\Admin\\CMSBatchAction')) {
|
||||
Config::inst()->update(
|
||||
'CMSBatchActionHandler',
|
||||
'SilverStripe\\Admin\\CMSBatchActionHandler',
|
||||
'batch_actions',
|
||||
array(
|
||||
$urlSegment => array(
|
||||
@ -230,7 +241,7 @@ class CMSBatchActionHandler extends RequestHandler {
|
||||
* @throws InvalidArgumentException if invalid action class is passed.
|
||||
*/
|
||||
protected function buildAction($class) {
|
||||
if(!is_subclass_of($class, 'CMSBatchAction')) {
|
||||
if(!is_subclass_of($class, 'SilverStripe\\Admin\\CMSBatchAction')) {
|
||||
throw new InvalidArgumentException("{$class} is not a valid subclass of CMSBatchAction");
|
||||
}
|
||||
return $class::singleton();
|
||||
|
@ -1,6 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\Security\Member;
|
||||
use Object;
|
||||
use IteratorAggregate;
|
||||
use i18nEntityProvider;
|
||||
use Config;
|
||||
use Controller;
|
||||
use Convert;
|
||||
use ClassInfo;
|
||||
use ReflectionClass;
|
||||
use ArrayIterator;
|
||||
use i18n;
|
||||
|
||||
/**
|
||||
* The object manages the main CMS menu. See {@link LeftAndMain::init()} for
|
||||
* example usage.
|
||||
@ -321,10 +335,10 @@ CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider {
|
||||
*/
|
||||
public static function get_cms_classes($root = null, $recursive = true, $sort = self::MENU_PRIORITY) {
|
||||
if(!$root) {
|
||||
$root = 'LeftAndMain';
|
||||
$root = 'SilverStripe\\Admin\\LeftAndMain';
|
||||
}
|
||||
/** @todo Make these actual abstract classes */
|
||||
$abstractClasses = ['LeftAndMain', 'SilverStripe\\CMS\\Controllers\\CMSMain'];
|
||||
$abstractClasses = ['SilverStripe\\Admin\\LeftAndMain', 'SilverStripe\\CMS\\Controllers\\CMSMain'];
|
||||
$subClasses = array_values(ClassInfo::subclassesFor($root));
|
||||
foreach($subClasses as $className) {
|
||||
if($recursive && $className != $root) {
|
||||
|
@ -1,5 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
use SilverStripe\ORM\FieldType\DBField;
|
||||
use Object;
|
||||
use Convert;
|
||||
|
||||
|
||||
/**
|
||||
* A simple CMS menu item.
|
||||
|
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Interface to provide enough information about a record to make it previewable
|
||||
* through the CMS. It uses the record database ID, its "frontend" and "backend"
|
||||
|
@ -1,8 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SS_HTTPResponse;
|
||||
use HiddenField;
|
||||
use FormAction;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\ORM\Versioning\ChangeSet;
|
||||
use SilverStripe\ORM\Versioning\ChangeSetItem;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Security\SecurityToken;
|
||||
use SilverStripe\Security\PermissionProvider;
|
||||
use Convert;
|
||||
use SS_HTTPResponse;
|
||||
use SS_HTTPRequest;
|
||||
use LogicException;
|
||||
use HiddenField;
|
||||
use Form;
|
||||
use FieldList;
|
||||
use FormAction;
|
||||
use Controller;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\GroupCsvBulkLoader;
|
||||
use Form;
|
||||
use FieldList;
|
||||
use LiteralField;
|
||||
use FileField;
|
||||
use FormAction;
|
||||
use RequiredFields;
|
||||
|
||||
|
||||
/**
|
||||
* Imports {@link Group} records by CSV upload, as defined in
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage admin
|
||||
@ -26,6 +29,37 @@ use SilverStripe\View\ThemeResourceLoader;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
||||
use Controller;
|
||||
use SSViewer;
|
||||
use Injector;
|
||||
use Director;
|
||||
use Convert;
|
||||
use SS_HTTPResponse;
|
||||
use Form;
|
||||
use Config;
|
||||
use i18n;
|
||||
use Session;
|
||||
use HTMLEditorConfig;
|
||||
use Requirements;
|
||||
use SS_HTTPRequest;
|
||||
use SS_HTTPResponse_Exception;
|
||||
use Deprecation;
|
||||
use PjaxResponseNegotiator;
|
||||
use ArrayData;
|
||||
use ReflectionClass;
|
||||
use InvalidArgumentException;
|
||||
use SiteConfig;
|
||||
use HiddenField;
|
||||
use LiteralField;
|
||||
use FormAction;
|
||||
use FieldList;
|
||||
use HTMLEditorField_Toolbar;
|
||||
use DropdownField;
|
||||
use PrintableTransformation;
|
||||
use SS_Cache;
|
||||
use ClassInfo;
|
||||
use ViewableData;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -230,7 +264,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
*/
|
||||
public function getCombinedClientConfig() {
|
||||
$combinedClientConfig = ['sections' => []];
|
||||
$cmsClassNames = CMSMenu::get_cms_classes('LeftAndMain', true, CMSMenu::URL_PRIORITY);
|
||||
$cmsClassNames = CMSMenu::get_cms_classes('SilverStripe\\Admin\\LeftAndMain', true, CMSMenu::URL_PRIORITY);
|
||||
|
||||
foreach ($cmsClassNames as $className) {
|
||||
$combinedClientConfig['sections'][$className] = Injector::inst()->get($className)->getClientConfig();
|
||||
@ -901,7 +935,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplatesWithSuffix($suffix) {
|
||||
return SSViewer::get_templates_by_class(get_class($this), $suffix, 'LeftAndMain');
|
||||
return SSViewer::get_templates_by_class(get_class($this), $suffix, 'SilverStripe\\Admin\\LeftAndMain');
|
||||
}
|
||||
|
||||
public function Content() {
|
||||
@ -980,7 +1014,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
// Validate classname
|
||||
$filterClass = $params['FilterClass'];
|
||||
$filterInfo = new ReflectionClass($filterClass);
|
||||
if(!$filterInfo->implementsInterface('LeftAndMain_SearchFilter')) {
|
||||
if(!$filterInfo->implementsInterface('SilverStripe\\Admin\\LeftAndMain_SearchFilter')) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid filter class passed: %s', $filterClass));
|
||||
}
|
||||
|
||||
@ -1073,21 +1107,21 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
return sprintf(
|
||||
'<ul><li class="readonly"><span class="item">'
|
||||
. '%s (<a href="%s" class="cms-panel-link" data-pjax-target="Content">%s</a>)'
|
||||
. '</span></li></ul>',
|
||||
_t('LeftAndMain.TooManyPages', 'Too many pages'),
|
||||
Controller::join_links(
|
||||
$controller->LinkWithSearch($controller->Link()), '
|
||||
?view=list&ParentID=' . $parent->ID
|
||||
),
|
||||
_t(
|
||||
'LeftAndMain.ShowAsList',
|
||||
'show as list',
|
||||
'Show large amount of pages in list instead of tree view'
|
||||
)
|
||||
);
|
||||
return sprintf(
|
||||
'<ul><li class="readonly"><span class="item">'
|
||||
. '%s (<a href="%s" class="cms-panel-link" data-pjax-target="Content">%s</a>)'
|
||||
. '</span></li></ul>',
|
||||
_t('LeftAndMain.TooManyPages', 'Too many pages'),
|
||||
Controller::join_links(
|
||||
$controller->LinkWithSearch($controller->Link()), '
|
||||
?view=list&ParentID=' . $parent->ID
|
||||
),
|
||||
_t(
|
||||
'LeftAndMain.ShowAsList',
|
||||
'show as list',
|
||||
'Show large amount of pages in list instead of tree view'
|
||||
)
|
||||
);
|
||||
};
|
||||
} else {
|
||||
$nodeCountCallback = null;
|
||||
@ -1476,7 +1510,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
}
|
||||
|
||||
// Added in-line to the form, but plucked into different view by frontend scripts.
|
||||
if(in_array('CMSPreviewable', class_implements($record))) {
|
||||
if ($record instanceof CMSPreviewable) {
|
||||
/** @skipUpgrade */
|
||||
$navField = new LiteralField('SilverStripeNavigator', $this->getSilverStripeNavigator());
|
||||
$navField->setAllowHTML(true);
|
||||
@ -1531,7 +1565,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
});
|
||||
|
||||
// Announce the capability so the frontend can decide whether to allow preview or not.
|
||||
if(in_array('CMSPreviewable', class_implements($record))) {
|
||||
if(in_array('SilverStripe\\Admin\\CMSPreviewable', class_implements($record))) {
|
||||
$form->addExtraClass('cms-previewable');
|
||||
}
|
||||
|
||||
@ -1902,7 +1936,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
*/
|
||||
public static function set_application_link($link) {
|
||||
Deprecation::notice('4.0', 'Use the "LeftAndMain.application_link" config setting instead');
|
||||
Config::inst()->update('LeftAndMain', 'application_link', $link);
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'application_link', $link);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1927,7 +1961,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
*/
|
||||
public static function setApplicationName($name) {
|
||||
Deprecation::notice('4.0', 'Use the "LeftAndMain.application_name" config setting instead');
|
||||
Config::inst()->update('LeftAndMain', 'application_name', $name);
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'application_name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1997,8 +2031,8 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
|
||||
// Add any custom ModelAdmin subclasses. Can't put this on ModelAdmin itself
|
||||
// since its marked abstract, and needs to be singleton instanciated.
|
||||
foreach(ClassInfo::subclassesFor('ModelAdmin') as $i => $class) {
|
||||
if($class == 'ModelAdmin') continue;
|
||||
foreach(ClassInfo::subclassesFor('SilverStripe\\Admin\\ModelAdmin') as $i => $class) {
|
||||
if($class == 'SilverStripe\\Admin\\ModelAdmin') continue;
|
||||
if(ClassInfo::classImplements($class, 'TestOnly')) continue;
|
||||
|
||||
$title = LeftAndMain::menu_title($class);
|
||||
@ -2024,7 +2058,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
*/
|
||||
public static function require_javascript($file) {
|
||||
Deprecation::notice('4.0', 'Use "LeftAndMain.extra_requirements_javascript" config setting instead');
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_javascript', array($file => array()));
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_javascript', array($file => array()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2037,7 +2071,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
*/
|
||||
public static function require_css($file, $media = null) {
|
||||
Deprecation::notice('4.0', 'Use "LeftAndMain.extra_requirements_css" config setting instead');
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_css', array($file => array('media' => $media)));
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_css', array($file => array('media' => $media)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2052,7 +2086,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
*/
|
||||
public static function require_themed_css($name, $media = null) {
|
||||
Deprecation::notice('4.0', 'Use "LeftAndMain.extra_requirements_themedCss" config setting instead');
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_themedCss', array($name => array('media' => $media)));
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_themedCss', array($name => array('media' => $media)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
use Extension;
|
||||
|
||||
|
||||
/**
|
||||
* Plug-ins for additional functionality in your LeftAndMain classes.
|
||||
*
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\Security\MemberCsvBulkLoader;
|
||||
use Form;
|
||||
use FieldList;
|
||||
use LiteralField;
|
||||
use FileField;
|
||||
use FormAction;
|
||||
use RequiredFields;
|
||||
use Requirements;
|
||||
|
||||
|
||||
/**
|
||||
* Imports {@link Member} records by CSV upload, as defined in
|
||||
|
@ -1,8 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\Security\Member;
|
||||
use Requirements;
|
||||
use GridFieldExportButton;
|
||||
use GridField;
|
||||
use GridFieldConfig_RecordEditor;
|
||||
use GridFieldPrintButton;
|
||||
use Form;
|
||||
use FieldList;
|
||||
use Controller;
|
||||
use Object;
|
||||
use RequiredFields;
|
||||
use ArrayLib;
|
||||
use ArrayData;
|
||||
use HiddenField;
|
||||
use FileField;
|
||||
use Convert;
|
||||
use LiteralField;
|
||||
use CheckboxField;
|
||||
use FormAction;
|
||||
use Deprecation;
|
||||
|
||||
|
||||
/**
|
||||
* Generates a three-pane UI for editing model classes, with an
|
||||
|
@ -1,11 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Admin;
|
||||
|
||||
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Security\PermissionRole;
|
||||
use SilverStripe\Security\PermissionProvider;
|
||||
use Requirements;
|
||||
use GridField;
|
||||
use GridFieldConfig_RecordEditor;
|
||||
use GridFieldButtonRow;
|
||||
use GridFieldExportButton;
|
||||
use Convert;
|
||||
use FieldList;
|
||||
use TabSet;
|
||||
use Tab;
|
||||
use LiteralField;
|
||||
use HiddenField;
|
||||
use HeaderField;
|
||||
use Form;
|
||||
use ArrayData;
|
||||
use Deprecation;
|
||||
use Config;
|
||||
|
||||
|
||||
/**
|
||||
* Security section of the CMS
|
||||
@ -236,7 +256,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
$group = $this->currentPage();
|
||||
$form = new MemberImportForm(
|
||||
$this,
|
||||
'MemberImportForm'
|
||||
'SilverStripe\\Admin\\MemberImportForm'
|
||||
);
|
||||
$form->setGroup($group);
|
||||
|
||||
@ -265,7 +285,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
$form = new GroupImportForm(
|
||||
$this,
|
||||
'GroupImportForm'
|
||||
'SilverStripe\\Admin\\GroupImportForm'
|
||||
);
|
||||
|
||||
return $form;
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Admin\CMSMenuItem;
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
|
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Admin\CMSMenu;
|
||||
use SilverStripe\Admin\LeftAndMain;
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
@ -16,7 +19,7 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
CMSMenu::add_controller('CMSMenuTest_LeftAndMainController');
|
||||
$menuItems = CMSMenu::get_menu_items();
|
||||
$menuItem = $menuItems['CMSMenuTest_LeftAndMainController'];
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
|
||||
$this->assertInstanceOf('SilverStripe\\Admin\\CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
|
||||
$this->assertContains($menuItem->url, singleton('CMSMenuTest_LeftAndMainController')->Link(),
|
||||
'Controller menu item has the correct link');
|
||||
$this->assertEquals($menuItem->controller, 'CMSMenuTest_LeftAndMainController',
|
||||
@ -29,7 +32,7 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
CMSMenu::add_controller('CMSMenuTest_CustomTitle');
|
||||
$menuItems = CMSMenu::get_menu_items();
|
||||
$menuItem = $menuItems['CMSMenuTest_CustomTitle'];
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
|
||||
$this->assertInstanceOf('SilverStripe\\Admin\\CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
|
||||
$this->assertEquals('CMSMenuTest_CustomTitle (localised)', $menuItem->title);
|
||||
CMSMenu::clear_menu();
|
||||
|
||||
@ -37,7 +40,7 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
CMSMenu::add_link('LinkCode', 'link title', 'http://www.example.com');
|
||||
$menuItems = CMSMenu::get_menu_items();
|
||||
$menuItem = $menuItems['LinkCode'];
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem');
|
||||
$this->assertInstanceOf('SilverStripe\\Admin\\CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem');
|
||||
$this->assertEquals($menuItem->title, 'link title', 'Link menu item has the correct title');
|
||||
$this->assertEquals($menuItem->url,'http://www.example.com', 'Link menu item has the correct link');
|
||||
$this->assertNull($menuItem->controller, 'Link menu item has no controller class');
|
||||
@ -78,9 +81,9 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
// 1.) SecurityAdmin is included
|
||||
// 2.) LeftAndMain & ModelAdmin are excluded
|
||||
$cmsClasses = CMSMenu::get_cms_classes();
|
||||
$this->assertContains('SecurityAdmin', $cmsClasses, 'SecurityAdmin included in valid CMS Classes');
|
||||
$this->assertNotContains('LeftAndMain', $cmsClasses, 'LeftAndMain not included in valid CMS Classes');
|
||||
$this->assertNotContains('ModelAdmin', $cmsClasses, 'LeftAndMain not included in valid CMS Classes');
|
||||
$this->assertContains('SilverStripe\\Admin\\SecurityAdmin', $cmsClasses, 'SecurityAdmin included in valid CMS Classes');
|
||||
$this->assertNotContains('SilverStripe\\Admin\\LeftAndMain', $cmsClasses, 'LeftAndMain not included in valid CMS Classes');
|
||||
$this->assertNotContains('SilverStripe\\Admin\\ModelAdmin', $cmsClasses, 'LeftAndMain not included in valid CMS Classes');
|
||||
|
||||
}
|
||||
|
||||
@ -89,13 +92,13 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
// Populate from CMS Classes, check for existance of SecurityAdmin
|
||||
CMSMenu::clear_menu();
|
||||
CMSMenu::populate_menu();
|
||||
$menuItem = CMSMenu::get_menu_item('SecurityAdmin');
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'SecurityAdmin menu item exists');
|
||||
$this->assertContains($menuItem->url, singleton('SecurityAdmin')->Link(), 'Menu item has the correct link');
|
||||
$this->assertEquals($menuItem->controller, 'SecurityAdmin', 'Menu item has the correct controller class');
|
||||
$menuItem = CMSMenu::get_menu_item('SilverStripe\\Admin\\SecurityAdmin');
|
||||
$this->assertInstanceOf('SilverStripe\\Admin\\CMSMenuItem', $menuItem, 'SecurityAdmin menu item exists');
|
||||
$this->assertContains($menuItem->url, singleton('SilverStripe\\Admin\\SecurityAdmin')->Link(), 'Menu item has the correct link');
|
||||
$this->assertEquals($menuItem->controller, 'SilverStripe\\Admin\\SecurityAdmin', 'Menu item has the correct controller class');
|
||||
$this->assertEquals(
|
||||
$menuItem->priority,
|
||||
singleton('SecurityAdmin')->stat('menu_priority'),
|
||||
singleton('SilverStripe\\Admin\\SecurityAdmin')->stat('menu_priority'),
|
||||
'Menu item has the correct priority'
|
||||
);
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Admin\CMSMenu;
|
||||
use SilverStripe\Admin\LeftAndMain;
|
||||
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
@ -21,15 +24,15 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
//$this->autoFollowRedirection = false;
|
||||
$this->resetMenu();
|
||||
|
||||
$this->backupCss = Config::inst()->get('LeftAndMain', 'extra_requirements_css');
|
||||
$this->backupJs = Config::inst()->get('LeftAndMain', 'extra_requirements_javascript');
|
||||
$this->backupCss = Config::inst()->get('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_css');
|
||||
$this->backupJs = Config::inst()->get('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_javascript');
|
||||
$this->backupCombined = Requirements::get_combined_files_enabled();
|
||||
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_css', array(
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_css', array(
|
||||
FRAMEWORK_DIR . '/tests/assets/LeftAndMainTest.css'
|
||||
));
|
||||
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_javascript', array(
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_javascript', array(
|
||||
FRAMEWORK_DIR . '/tests/assets/LeftAndMainTest.js'
|
||||
));
|
||||
|
||||
@ -56,8 +59,8 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_css', $this->backupCss);
|
||||
Config::inst()->update('LeftAndMain', 'extra_requirements_javascript', $this->backupJs);
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_css', $this->backupCss);
|
||||
Config::inst()->update('SilverStripe\\Admin\\LeftAndMain', 'extra_requirements_javascript', $this->backupJs);
|
||||
|
||||
Requirements::set_combined_files_enabled($this->backupCombined);
|
||||
}
|
||||
@ -150,7 +153,7 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
$this->session()->inst_set('loggedInAs', $adminuser->ID);
|
||||
|
||||
$this->resetMenu();
|
||||
$menuItems = singleton('LeftAndMain')->MainMenu(false);
|
||||
$menuItems = singleton('SilverStripe\\Admin\\LeftAndMain')->MainMenu(false);
|
||||
foreach($menuItems as $menuItem) {
|
||||
$link = $menuItem->Link;
|
||||
|
||||
@ -180,7 +183,7 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
// anonymous user
|
||||
$this->session()->inst_set('loggedInAs', null);
|
||||
$this->resetMenu();
|
||||
$menuItems = singleton('LeftAndMain')->MainMenu(false);
|
||||
$menuItems = singleton('SilverStripe\\Admin\\LeftAndMain')->MainMenu(false);
|
||||
$this->assertEquals(
|
||||
array_map($allValsFn, $menuItems->column('Code')),
|
||||
array(),
|
||||
@ -190,24 +193,24 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
// restricted cms user
|
||||
$this->logInAs($securityonlyuser);
|
||||
$this->resetMenu();
|
||||
$menuItems = singleton('LeftAndMain')->MainMenu(false);
|
||||
$menuItems = singleton('SilverStripe\\Admin\\LeftAndMain')->MainMenu(false);
|
||||
$menuItems = array_map($allValsFn, $menuItems->column('Code'));
|
||||
sort($menuItems);
|
||||
$this->assertEquals(
|
||||
$menuItems,
|
||||
array('CMSProfileController', 'Help', 'SecurityAdmin'),
|
||||
array('SilverStripe\\Admin\\CMSProfileController', 'Help', 'SilverStripe\\Admin\\SecurityAdmin'),
|
||||
'Groups with limited access can only access the interfaces they have permissions for'
|
||||
);
|
||||
|
||||
// all cms sections user
|
||||
$this->logInAs($allcmssectionsuser);
|
||||
$this->resetMenu();
|
||||
$menuItems = singleton('LeftAndMain')->MainMenu(false);
|
||||
$this->assertContains('CMSProfileController',
|
||||
$menuItems = singleton('SilverStripe\\Admin\\LeftAndMain')->MainMenu(false);
|
||||
$this->assertContains('SilverStripe\\Admin\\CMSProfileController',
|
||||
array_map($allValsFn, $menuItems->column('Code')),
|
||||
'Group with CMS_ACCESS_LeftAndMain permission can edit own profile'
|
||||
);
|
||||
$this->assertContains('SecurityAdmin',
|
||||
$this->assertContains('SilverStripe\\Admin\\SecurityAdmin',
|
||||
array_map($allValsFn, $menuItems->column('Code')),
|
||||
'Group with CMS_ACCESS_LeftAndMain permission can access all sections'
|
||||
);
|
||||
@ -219,9 +222,9 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
// admin
|
||||
$this->logInAs($adminuser);
|
||||
$this->resetMenu();
|
||||
$menuItems = singleton('LeftAndMain')->MainMenu(false);
|
||||
$menuItems = singleton('SilverStripe\\Admin\\LeftAndMain')->MainMenu(false);
|
||||
$this->assertContains(
|
||||
'SecurityAdmin',
|
||||
'SilverStripe\\Admin\\SecurityAdmin',
|
||||
array_map($allValsFn, $menuItems->column('Code')),
|
||||
'Administrators can access Security Admin'
|
||||
);
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Admin\ModelAdmin;
|
||||
|
||||
|
||||
|
||||
class ModelAdminTest extends FunctionalTest {
|
||||
|
@ -11,6 +11,9 @@ use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Admin\AdminRootController;
|
||||
use SilverStripe\Admin\CMSPreviewable;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,6 +6,8 @@ use SilverStripe\ORM\HasManyList;
|
||||
use SilverStripe\ORM\ManyManyList;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||
use SilverStripe\Admin\LeftAndMain;
|
||||
|
||||
|
||||
/**
|
||||
* Provides view and edit forms at GridField-specific URLs.
|
||||
|
@ -60,7 +60,7 @@ class NamespacedClassManifestTest extends SapphireTest {
|
||||
$method->setAccessible(true);
|
||||
|
||||
$expectedImports = array(
|
||||
'ModelAdmin',
|
||||
'SilverStripe\\Admin\\ModelAdmin',
|
||||
'Cont' => 'Controller',
|
||||
'Request' => 'SS_HTTPRequest',
|
||||
'Response' => 'SS_HTTPResponse',
|
||||
@ -83,9 +83,9 @@ class NamespacedClassManifestTest extends SapphireTest {
|
||||
// including all core classes
|
||||
$method = new ReflectionMethod($this->manifest, 'coalesceDescendants');
|
||||
$method->setAccessible(true);
|
||||
$method->invoke($this->manifest, 'ModelAdmin');
|
||||
$method->invoke($this->manifest, 'SilverStripe\\Admin\\ModelAdmin');
|
||||
|
||||
$this->assertContains('SilverStripe\Framework\Tests\ClassI', ClassInfo::subclassesFor('ModelAdmin'));
|
||||
$this->assertContains('SilverStripe\Framework\Tests\ClassI', ClassInfo::subclassesFor('SilverStripe\\Admin\\ModelAdmin'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@
|
||||
namespace SilverStripe\Framework\Tests;
|
||||
|
||||
//whitespace here is important for tests, please don't change it
|
||||
use ModelAdmin;
|
||||
use SilverStripe\Admin\ModelAdmin;
|
||||
use Controller as Cont ;
|
||||
use SS_HTTPRequest as Request, SS_HTTPResponse as Response, SilverStripe\Security\PermissionProvider as P;
|
||||
use silverstripe\test\ClassA;
|
||||
|
Loading…
x
Reference in New Issue
Block a user