mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
Merge pull request #1871 from sminnee/resource-loading
NEW: Remove use of MODULE_DIR constants
This commit is contained in:
commit
b89aa98402
@ -17,14 +17,10 @@ use SilverStripe\View\Parsers\ShortcodeParser;
|
|||||||
* - CMS_PATH: Absolute filepath, e.g. "/var/www/my-webroot/cms"
|
* - CMS_PATH: Absolute filepath, e.g. "/var/www/my-webroot/cms"
|
||||||
*/
|
*/
|
||||||
call_user_func(function () {
|
call_user_func(function () {
|
||||||
define('CMS_PATH', __DIR__);
|
|
||||||
|
|
||||||
// Check if CMS is root dir, or subdir
|
// Check if CMS is root dir, or subdir
|
||||||
if (strcasecmp(__DIR__, BASE_PATH) === 0) {
|
if (strcasecmp(__DIR__, BASE_PATH) === 0) {
|
||||||
define('CMS_DIR', '');
|
|
||||||
$clientPath = 'client';
|
$clientPath = 'client';
|
||||||
} else {
|
} else {
|
||||||
define('CMS_DIR', basename(__DIR__));
|
|
||||||
$clientPath = basename(__DIR__) . '/client';
|
$clientPath = basename(__DIR__) . '/client';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ use SilverStripe\Control\HTTPResponse;
|
|||||||
use SilverStripe\Control\HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||||
use Psr\SimpleCache\CacheInterface;
|
use Psr\SimpleCache\CacheInterface;
|
||||||
use SilverStripe\Forms\DateField;
|
use SilverStripe\Forms\DateField;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
@ -164,11 +165,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
Requirements::javascript(CMS_DIR . '/client/dist/js/bundle.js');
|
Requirements::javascript('silverstripe/cms: client/dist/js/bundle.js');
|
||||||
Requirements::javascript(CMS_DIR . '/client/dist/js/SilverStripeNavigator.js');
|
Requirements::javascript('silverstripe/cms: client/dist/js/SilverStripeNavigator.js');
|
||||||
Requirements::css(CMS_DIR . '/client/dist/styles/bundle.css');
|
Requirements::css('silverstripe/cms: client/dist/styles/bundle.css');
|
||||||
Requirements::customCSS($this->generatePageIconsCss());
|
Requirements::customCSS($this->generatePageIconsCss());
|
||||||
Requirements::add_i18n_javascript(CMS_DIR . '/client/lang', false, true);
|
|
||||||
|
$module = ModuleLoader::getModule('silverstripe/cms');
|
||||||
|
Requirements::add_i18n_javascript($module->getRelativeResourcePath('client/lang'), false, true);
|
||||||
|
|
||||||
CMSBatchActionHandler::register('restore', CMSBatchAction_Restore::class);
|
CMSBatchActionHandler::register('restore', CMSBatchAction_Restore::class);
|
||||||
CMSBatchActionHandler::register('archive', CMSBatchAction_Archive::class);
|
CMSBatchActionHandler::register('archive', CMSBatchAction_Archive::class);
|
||||||
|
@ -328,9 +328,9 @@ class ContentController extends Controller
|
|||||||
|
|
||||||
if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
|
if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
|
||||||
if ($this->dataRecord) {
|
if ($this->dataRecord) {
|
||||||
Requirements::css(CMS_DIR . '/client/dist/styles/SilverStripeNavigator.css');
|
Requirements::css('silverstripe/cms: client/dist/styles/SilverStripeNavigator.css');
|
||||||
Requirements::javascript(ADMIN_THIRDPARTY_DIR . '/jquery/jquery.js');
|
Requirements::javascript('silverstripe/admin: thirdparty/jquery/jquery.js');
|
||||||
Requirements::javascript(CMS_DIR . '/client/dist/js/SilverStripeNavigator.js');
|
Requirements::javascript('silverstripe/cms: client/dist/js/SilverStripeNavigator.js');
|
||||||
|
|
||||||
$return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);
|
$return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);
|
||||||
$items = $return['items'];
|
$items = $return['items'];
|
||||||
@ -370,7 +370,7 @@ HTML;
|
|||||||
// On live sites we should still see the archived message
|
// On live sites we should still see the archived message
|
||||||
} else {
|
} else {
|
||||||
if ($date = Versioned::current_archived_date()) {
|
if ($date = Versioned::current_archived_date()) {
|
||||||
Requirements::css(CMS_DIR . '/client/dist/styles/SilverStripeNavigator.css');
|
Requirements::css('silverstripe/cms: client/dist/styles/SilverStripeNavigator.css');
|
||||||
/** @var DBDatetime $dateObj */
|
/** @var DBDatetime $dateObj */
|
||||||
$dateObj = DBField::create_field('Datetime', $date);
|
$dateObj = DBField::create_field('Datetime', $date);
|
||||||
// $dateObj->setVal($date);
|
// $dateObj->setVal($date);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user