mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Apply SilverStripe\Admin namespace
This commit is contained in:
parent
095ae30a3e
commit
2352127fe0
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\Admin\CMSMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* - CMS_DIR: Path relative to webroot, e.g. "cms"
|
* - CMS_DIR: Path relative to webroot, e.g. "cms"
|
||||||
* - CMS_PATH: Absolute filepath, e.g. "/var/www/my-webroot/cms"
|
* - CMS_PATH: Absolute filepath, e.g. "/var/www/my-webroot/cms"
|
||||||
|
@ -7,7 +7,8 @@ use SilverStripe\ORM\SS_List;
|
|||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use CMSBatchAction;
|
use SilverStripe\Admin\CMSBatchAction;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,6 @@ use SilverStripe\ORM\DataObject;
|
|||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\Security\PermissionProvider;
|
use SilverStripe\Security\PermissionProvider;
|
||||||
use LeftAndMain;
|
|
||||||
use Session;
|
use Session;
|
||||||
use Requirements;
|
use Requirements;
|
||||||
use CMSBatchActionHandler;
|
use CMSBatchActionHandler;
|
||||||
@ -51,6 +50,10 @@ use Injector;
|
|||||||
use Director;
|
use Director;
|
||||||
use ArrayData;
|
use ArrayData;
|
||||||
use CMSBatchAction;
|
use CMSBatchAction;
|
||||||
|
use SilverStripe\Admin\CMSBatchActionHandler;
|
||||||
|
use SilverStripe\Admin\LeftAndMain;
|
||||||
|
use SilverStripe\Admin\CMSBatchAction;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\CMS\Controllers;
|
namespace SilverStripe\CMS\Controllers;
|
||||||
|
|
||||||
use ResetFormAction;
|
use ResetFormAction;
|
||||||
|
use SilverStripe\Admin\CMSPreviewable;
|
||||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
@ -16,7 +17,10 @@ use SilverStripe\Security\Security;
|
|||||||
use SilverStripe\Security\SecurityToken;
|
use SilverStripe\Security\SecurityToken;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\Security\PermissionProvider;
|
use SilverStripe\Security\PermissionProvider;
|
||||||
use LeftAndMain;
|
use SilverStripe\Admin\CMSBatchActionHandler;
|
||||||
|
use SilverStripe\Admin\AdminRootController;
|
||||||
|
use SilverStripe\Admin\AddToCampaignHandler;
|
||||||
|
use SilverStripe\Admin\LeftAndMain;
|
||||||
|
|
||||||
|
|
||||||
use SS_HTTPRequest;
|
use SS_HTTPRequest;
|
||||||
@ -485,14 +489,14 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$json = '';
|
$json = '';
|
||||||
$classes = SiteTree::page_type_classes();
|
$classes = SiteTree::page_type_classes();
|
||||||
|
|
||||||
$cacheCanCreate = array();
|
$cacheCanCreate = array();
|
||||||
foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate();
|
foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate();
|
||||||
|
|
||||||
// Generate basic cache key. Too complex to encompass all variations
|
// Generate basic cache key. Too complex to encompass all variations
|
||||||
$cache = SS_Cache::factory('CMSMain_SiteTreeHints');
|
$cache = SS_Cache::factory('CMSMain_SiteTreeHints');
|
||||||
$cacheKey = md5(implode('_', array(Member::currentUserID(), implode(',', $cacheCanCreate), implode(',', $classes))));
|
$cacheKey = md5(implode('_', array(Member::currentUserID(), implode(',', $cacheCanCreate), implode(',', $classes))));
|
||||||
if($this->getRequest()->getVar('flush')) $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
if($this->getRequest()->getVar('flush')) $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
||||||
$json = $cache->load($cacheKey);
|
$json = $cache->load($cacheKey);
|
||||||
if(!$json) {
|
if(!$json) {
|
||||||
$def['Root'] = array();
|
$def['Root'] = array();
|
||||||
$def['Root']['disallowedChildren'] = array();
|
$def['Root']['disallowedChildren'] = array();
|
||||||
@ -734,7 +738,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$form->setValidationExemptActions(array('restore', 'revert', 'deletefromlive', 'delete', 'unpublish', 'rollback', 'doRollback'));
|
$form->setValidationExemptActions(array('restore', 'revert', 'deletefromlive', 'delete', 'unpublish', 'rollback', 'doRollback'));
|
||||||
|
|
||||||
// Announce the capability so the frontend can decide whether to allow preview or not.
|
// Announce the capability so the frontend can decide whether to allow preview or not.
|
||||||
if(in_array('CMSPreviewable', class_implements($record))) {
|
if ($record instanceof CMSPreviewable) {
|
||||||
$form->addExtraClass('cms-previewable');
|
$form->addExtraClass('cms-previewable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,10 @@ use SilverStripe\ORM\DataList;
|
|||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use Object;
|
use Object;
|
||||||
use LeftAndMain_SearchFilter;
|
|
||||||
use ClassInfo;
|
use ClassInfo;
|
||||||
use DateField;
|
use DateField;
|
||||||
|
use SilverStripe\Admin\LeftAndMain_SearchFilter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for filtering the subtree for certain node statuses.
|
* Base class for filtering the subtree for certain node statuses.
|
||||||
|
@ -9,10 +9,11 @@ use SilverStripe\ORM\Versioning\Versioned;
|
|||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use ViewableData;
|
use ViewableData;
|
||||||
use CMSPreviewable;
|
|
||||||
use ClassInfo;
|
use ClassInfo;
|
||||||
use LeftAndMain;
|
|
||||||
use Controller;
|
use Controller;
|
||||||
|
use SilverStripe\Admin\CMSPreviewable;
|
||||||
|
use SilverStripe\Admin\LeftAndMain;
|
||||||
|
|
||||||
|
|
||||||
use SiteTreeFutureState;
|
use SiteTreeFutureState;
|
||||||
use SilverStripe\CMS\Model\RedirectorPage;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
@ -222,7 +223,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
(!$currentDraft || ($currentDraft && $this->record->Version != $currentDraft->Version))
|
(!$currentDraft || ($currentDraft && $this->record->Version != $currentDraft->Version))
|
||||||
&& (!$currentLive || ($currentLive && $this->record->Version != $currentLive->Version))
|
&& (!$currentLive || ($currentLive && $this->record->Version != $currentLive->Version))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->record->_cached_isArchived;
|
return $this->record->_cached_isArchived;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ use SilverStripe\Security\Permission;
|
|||||||
use SilverStripe\Security\Group;
|
use SilverStripe\Security\Group;
|
||||||
use SilverStripe\Security\PermissionProvider;
|
use SilverStripe\Security\PermissionProvider;
|
||||||
use i18nEntityProvider;
|
use i18nEntityProvider;
|
||||||
use CMSPreviewable;
|
|
||||||
use Director;
|
use Director;
|
||||||
use SilverStripe\CMS\Controllers\RootURLController;
|
use SilverStripe\CMS\Controllers\RootURLController;
|
||||||
use ClassInfo;
|
use ClassInfo;
|
||||||
@ -52,9 +51,11 @@ use TreeDropdownField;
|
|||||||
use FieldGroup;
|
use FieldGroup;
|
||||||
use CheckboxField;
|
use CheckboxField;
|
||||||
use ListboxField;
|
use ListboxField;
|
||||||
use AddToCampaignHandler_FormAction;
|
|
||||||
use FormAction;
|
use FormAction;
|
||||||
use i18n;
|
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
|
* Basic data-object representing all pages within the site tree. All page types that live within the hierarchy should
|
||||||
@ -352,13 +353,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
foreach($alternatives as $alternative) {
|
foreach($alternatives as $alternative) {
|
||||||
if($alternative) {
|
if($alternative) {
|
||||||
$sitetree = $alternative;
|
$sitetree = $alternative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$sitetree) {
|
if(!$sitetree) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have any more URL parts to parse.
|
// Check if we have any more URL parts to parse.
|
||||||
@ -437,8 +438,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Replace a "[sitetree_link id=n]" shortcode with a link to the page with the corresponding ID.
|
* Replace a "[sitetree_link id=n]" shortcode with a link to the page with the corresponding ID.
|
||||||
*
|
*
|
||||||
* @param array $arguments
|
* @param array $arguments
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param ShortcodeParser $parser
|
* @param ShortcodeParser $parser
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -609,7 +610,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
$currentPage = Director::get_current_page();
|
$currentPage = Director::get_current_page();
|
||||||
if ($currentPage instanceof ContentController) {
|
if ($currentPage instanceof ContentController) {
|
||||||
$currentPage = $currentPage->data();
|
$currentPage = $currentPage->data();
|
||||||
}
|
}
|
||||||
if($currentPage instanceof SiteTree) {
|
if($currentPage instanceof SiteTree) {
|
||||||
return $currentPage === $this || $currentPage->ID === $this->ID;
|
return $currentPage === $this || $currentPage->ID === $this->ID;
|
||||||
}
|
}
|
||||||
@ -1467,7 +1468,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Permission::check('CMS_ACCESS_CMSMain')
|
if(Permission::check('CMS_ACCESS_CMSMain')
|
||||||
&& in_array('CMSPreviewable', class_implements($this))
|
|
||||||
&& !$this instanceof ErrorPage
|
&& !$this instanceof ErrorPage
|
||||||
&& $this->ID > 0
|
&& $this->ID > 0
|
||||||
) {
|
) {
|
||||||
@ -1552,7 +1552,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
DB::alteration_message('Contact Us page created', 'created');
|
DB::alteration_message('Contact Us page created', 'created');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function onBeforeWrite() {
|
protected function onBeforeWrite() {
|
||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
@ -1877,10 +1877,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
if($parentPage && $parentPage->exists()) {
|
if($parentPage && $parentPage->exists()) {
|
||||||
$link = Convert::raw2att($parentPage->CMSEditLink());
|
$link = Convert::raw2att($parentPage->CMSEditLink());
|
||||||
$title = Convert::raw2xml($parentPage->Title);
|
$title = Convert::raw2xml($parentPage->Title);
|
||||||
} else {
|
} else {
|
||||||
$link = CMSPageEditController::singleton()->Link('show');
|
$link = CMSPageEditController::singleton()->Link('show');
|
||||||
$title = _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)');
|
$title = _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)');
|
||||||
}
|
}
|
||||||
$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"{$link}\">{$title}</a>";
|
$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"{$link}\">{$title}</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ use SilverStripe\ORM\Versioning\Versioned;
|
|||||||
use SilverStripe\ORM\HiddenClass;
|
use SilverStripe\ORM\HiddenClass;
|
||||||
use SilverStripe\CMS\Controllers\CMSMain;
|
use SilverStripe\CMS\Controllers\CMSMain;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
|
use SilverStripe\Admin\CMSBatchActionHandler;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user