From a322fbd59f6d5f67359dcbbbff89c7dd64e4d411 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 28 Sep 2008 13:12:20 +0000 Subject: [PATCH] ENHANCEMENT Introduced constants for system paths like /sapphire in preparation for a more flexible directory reorganisation. Instead of hardcoding your path, please use the following constants: BASE_PATH, BASE_URL, SAPPHIRE_DIR, SAPPHIRE_PATH, CMS_DIR, CMS_PATH, THIRDPARTY_DIR, THIRDPARTY_PATH, ASSETS_DIR, ASSETS_PATH, THEMES_DIR, THEMES_PATH git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63175 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CommentAdmin.php | 4 ++-- code/CommentTableField.php | 2 +- code/GenericDataAdmin.php | 18 +++++++++--------- code/MemberTableField.php | 8 ++++---- code/ModelAdmin.php | 20 ++++++++++---------- code/PageTypes/UserDefinedForm.php | 4 ++-- code/ReportAdmin.php | 20 ++++++++++---------- code/ThumbnailStripField.php | 2 +- code/sitefeatures/PageCommentInterface.php | 8 ++++---- 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/code/CommentAdmin.php b/code/CommentAdmin.php index e56a5d34..f8061c7e 100644 --- a/code/CommentAdmin.php +++ b/code/CommentAdmin.php @@ -18,8 +18,8 @@ class CommentAdmin extends LeftAndMain { public function init() { parent::init(); - Requirements::javascript('cms/javascript/CommentAdmin_right.js'); - Requirements::css('cms/css/CommentAdmin.css'); + Requirements::javascript(CMS_DIR . '/javascript/CommentAdmin_right.js'); + Requirements::css(CMS_DIR . 'css/CommentAdmin.css'); } public function Link($action = null) { diff --git a/code/CommentTableField.php b/code/CommentTableField.php index 74550fe3..b7f9f72a 100644 --- a/code/CommentTableField.php +++ b/code/CommentTableField.php @@ -22,7 +22,7 @@ class CommentTableField extends ComplexTableField { $this->sourceFilter[] = "( `Name` LIKE '%$search%' OR `Comment` LIKE '%$search%')"; } - Requirements::javascript('cms/javascript/CommentTableField.js'); + Requirements::javascript(CMS_DIR . '/javascript/CommentTableField.js'); } function Items() { diff --git a/code/GenericDataAdmin.php b/code/GenericDataAdmin.php index 3dc61958..c0fbbc60 100755 --- a/code/GenericDataAdmin.php +++ b/code/GenericDataAdmin.php @@ -77,17 +77,17 @@ abstract class GenericDataAdmin extends LeftAndMain { parent::init(); Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); - Requirements::javascript("jsparty/tiny_mce_improvements.js"); + Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js"); - Requirements::javascript("jsparty/hover.js"); - Requirements::javascript("jsparty/scriptaculous/controls.js"); + Requirements::javascript(THIRDPARTY_DIR . "/hover.js"); + Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js"); - Requirements::javascript("cms/javascript/SecurityAdmin.js"); - Requirements::javascript("cms/javascript/CMSMain_left.js"); + Requirements::javascript(CMS_DIR . "/javascript/SecurityAdmin.js"); + Requirements::javascript(CMS_DIR . "/javascript/CMSMain_left.js"); - Requirements::javascript("cms/javascript/GenericDataAdmin_left.js"); - Requirements::javascript("cms/javascript/GenericDataAdmin_right.js"); - Requirements::javascript("cms/javascript/SideTabs.js"); + Requirements::javascript(CMS_DIR . "/javascript/GenericDataAdmin_left.js"); + Requirements::javascript(CMS_DIR . "/javascript/GenericDataAdmin_right.js"); + Requirements::javascript(CMS_DIR . "/javascript/SideTabs.js"); // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment if(!Director::is_ajax()) { @@ -98,7 +98,7 @@ abstract class GenericDataAdmin extends LeftAndMain { )); } - Requirements::css("cms/css/GenericDataAdmin.css"); + Requirements::css(CMS_DIR . "/css/GenericDataAdmin.css"); //For wrightgroup workshop Requirements::css("writework/css/WorkshopCMSLayout.css"); diff --git a/code/MemberTableField.php b/code/MemberTableField.php index 8e90894a..dc9321ea 100755 --- a/code/MemberTableField.php +++ b/code/MemberTableField.php @@ -123,8 +123,8 @@ class MemberTableField extends ComplexTableField { parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields); - Requirements::javascript('cms/javascript/MemberTableField.js'); - Requirements::javascript("cms/javascript/MemberTableField_popup.js"); + Requirements::javascript(CMS_DIR . '/javascript/MemberTableField.js'); + Requirements::javascript(CMS_DIR . "/javascript/MemberTableField_popup.js"); // construct the filter and sort if(isset($_REQUEST['MemberOrderByField'])) { @@ -428,8 +428,8 @@ class MemberTableField_Popup extends ComplexTableField_Popup { function __construct($controller, $name, $fields, $sourceClass, $readonly=false, $validator = null) { parent::__construct($controller, $name, $fields, $sourceClass, $readonly, $validator); - Requirements::javascript('cms/javascript/MemberTableField.js'); - Requirements::javascript('cms/javascript/MemberTableField_popup.js'); + Requirements::javascript(CMS_DIR . '/javascript/MemberTableField.js'); + Requirements::javascript(CMS_DIR . '/javascript/MemberTableField_popup.js'); } /** diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index da68a904..98e732d5 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -102,17 +102,17 @@ abstract class ModelAdmin extends LeftAndMain { //user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR); } - Requirements::css('cms/css/ModelAdmin.css'); // standard layout formatting for management UI - Requirements::css('cms/css/silverstripe.tabs.css'); // follows the jQuery UI theme conventions + Requirements::css(CMS_DIR . 'css/ModelAdmin.css'); // standard layout formatting for management UI + Requirements::css(CMS_DIR . 'css/silverstripe.tabs.css'); // follows the jQuery UI theme conventions - Requirements::javascript('jsparty/jquery/jquery.js'); - Requirements::javascript('jsparty/jquery/plugins/livequery/jquery.livequery.js'); - Requirements::javascript('jsparty/jquery/ui/ui.core.js'); - Requirements::javascript('jsparty/jquery/ui/ui.tabs.js'); - Requirements::javascript('jsparty/jquery/plugins/form/jquery.form.js'); - Requirements::javascript('jsparty/jquery/plugins/effen/jquery.fn.js'); - Requirements::javascript('jsparty/jquery/jquery_improvements.js'); - Requirements::javascript('cms/javascript/ModelAdmin.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/jquery.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/plugins/livequery/jquery.livequery.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/ui/ui.core.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/ui/ui.tabs.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/plugins/form/jquery.form.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/plugins/effen/jquery.fn.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/jquery/jquery_improvements.js'); + Requirements::javascript(CMS_DIR . '/javascript/ModelAdmin.js'); } /** diff --git a/code/PageTypes/UserDefinedForm.php b/code/PageTypes/UserDefinedForm.php index da815ee3..cd3dfc8d 100755 --- a/code/PageTypes/UserDefinedForm.php +++ b/code/PageTypes/UserDefinedForm.php @@ -161,8 +161,8 @@ class UserDefinedForm extends Page { class UserDefinedForm_Controller extends Page_Controller { function init() { - Requirements::javascript('jsparty/prototype-safe.js'); - Requirements::javascript('jsparty/behaviour.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/prototype-safe.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/behaviour.js'); parent::init(); } diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index 958110fa..2e5c2603 100755 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -13,22 +13,22 @@ class ReportAdmin extends LeftAndMain { parent::init(); Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); - Requirements::javascript("jsparty/tiny_mce_improvements.js"); + Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js"); - Requirements::javascript("jsparty/hover.js"); - Requirements::javascript("jsparty/scriptaculous/controls.js"); + Requirements::javascript(THIRDPARTY_DIR . "/hover.js"); + Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js"); - Requirements::javascript("cms/javascript/SecurityAdmin.js"); + Requirements::javascript(CMS_DIR . "/javascript/SecurityAdmin.js"); - Requirements::javascript("cms/javascript/LeftAndMain_left.js"); - Requirements::javascript("cms/javascript/LeftAndMain_right.js"); - Requirements::javascript("cms/javascript/CMSMain_left.js"); + Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_left.js"); + Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_right.js"); + Requirements::javascript(CMS_DIR . "/javascript/CMSMain_left.js"); - Requirements::javascript("cms/javascript/ReportAdmin_left.js"); - Requirements::javascript("cms/javascript/ReportAdmin_right.js"); + Requirements::javascript(CMS_DIR . "/javascript/ReportAdmin_left.js"); + Requirements::javascript(CMS_DIR . "/javascript/ReportAdmin_right.js"); - Requirements::css("cms/css/ReportAdmin.css"); + Requirements::css(CMS_DIR . "/css/ReportAdmin.css"); // TODO Find a better solution to integrate optional Requirements in a specific order if(Director::fileExists("ecommerce/css/DataReportCMSMain.css")) { diff --git a/code/ThumbnailStripField.php b/code/ThumbnailStripField.php index a5d59d04..3bdee102 100755 --- a/code/ThumbnailStripField.php +++ b/code/ThumbnailStripField.php @@ -22,7 +22,7 @@ class ThumbnailStripField extends FormField { } function FieldHolder() { - Requirements::javascript('cms/javascript/ThumbnailStripField.js'); + Requirements::javascript(CMS_DIR . '/javascript/ThumbnailStripField.js'); return $this->renderWith('ThumbnailStripField'); } diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index 4db67210..57860efd 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -100,10 +100,10 @@ class PageCommentInterface extends RequestHandlingData { } function PostCommentForm() { - Requirements::javascript('jsparty/behaviour.js'); - Requirements::javascript('jsparty/prototype.js'); - Requirements::javascript('jsparty/scriptaculous/effects.js'); - Requirements::javascript('cms/javascript/PageCommentInterface.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/behaviour.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/prototype.js'); + Requirements::javascript(THIRDPARTY_DIR . 'jsparty/scriptaculous/effects.js'); + Requirements::javascript(CMS_DIR . '/javascript/PageCommentInterface.js'); $fields = new FieldSet(