From 9c81737a5724cec74504c333b96d1ee86e7e8eea Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 4 Dec 2008 01:47:41 +0000 Subject: [PATCH] BUGFIX Moving Requirements::combine_files() calls from cms/_config.php to LeftAndMain->init() to avoid side-effects in non-CMS contexts. Examples: - including prototype.js in a website had caused jQuery to be loaded as well through base.js - including greybox.js had caused the screen to become unscrollable because of an (unrelated) inclusion of LeftAndMain.js which sets to overflow:hidden on javascript page load git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@67401 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- _config.php | 58 -------------------------------------------- code/LeftAndMain.php | 58 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/_config.php b/_config.php index df408b7b..dea406da 100644 --- a/_config.php +++ b/_config.php @@ -20,64 +20,6 @@ Director::addRules(50, array( CMSMenu::populate_menu(); -// Javascript combined files -Requirements::combine_files( - 'assets/base.js', - array( - 'jsparty/prototype.js', - 'jsparty/behaviour.js', - 'jsparty/prototype_improvements.js', - 'jsparty/jquery/jquery.js', - 'jsparty/jquery/plugins/livequery/jquery.livequery.js', - 'jsparty/jquery/plugins/effen/jquery.fn.js', - 'sapphire/javascript/core/jquery.ondemand.js', - 'jsparty/jquery/jquery_improvements.js', - 'jsparty/firebug/firebugx.js', - 'sapphire/javascript/i18n.js', - ) -); - -Requirements::combine_files( - 'assets/leftandmain.js', - array( - 'jsparty/loader.js', - 'jsparty/hover.js', - 'jsparty/layout_helpers.js', - 'jsparty/scriptaculous/effects.js', - 'jsparty/scriptaculous/dragdrop.js', - 'jsparty/scriptaculous/controls.js', - 'jsparty/greybox/AmiJS.js', - 'jsparty/greybox/greybox.js', - 'cms/javascript/LeftAndMain.js', - 'cms/javascript/LeftAndMain_left.js', - 'cms/javascript/LeftAndMain_right.js', - //'jsparty/tiny_mce2/tiny_mce_src.js', - 'jsparty/tree/tree.js', - 'jsparty/tabstrip/tabstrip.js', - 'cms/javascript/TinyMCEImageEnhancement.js', - 'jsparty/SWFUpload/SWFUpload.js', - 'cms/javascript/Upload.js', - 'sapphire/javascript/TreeSelectorField.js', - 'cms/javascript/ThumbnailStripField.js', - ) -); - -Requirements::combine_files( - 'assets/cmsmain.js', - array( - 'cms/javascript/CMSMain.js', - 'cms/javascript/CMSMain_left.js', - 'cms/javascript/CMSMain_right.js', - 'cms/javascript/SideTabs.js', - 'cms/javascript/SideReports.js', - 'cms/javascript/LangSelector.js', - 'cms/javascript/TranslationTab.js', - 'jsparty/calendar/calendar.js', - 'jsparty/calendar/lang/calendar-en.js', - 'jsparty/calendar/calendar-setup.js', - ) -); - CMSMenu::add_link( 'Help', _t('LeftAndMain.HELP', 'Help', PR_HIGH, 'Menu title'), diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 278a6c67..dddc6cd1 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -182,6 +182,64 @@ class LeftAndMain extends Controller { } Requirements::customScript('Behaviour.addLoader(hideLoading);'); + + // Javascript combined files + Requirements::combine_files( + 'assets/base.js', + array( + 'jsparty/prototype.js', + 'jsparty/behaviour.js', + 'jsparty/prototype_improvements.js', + 'jsparty/jquery/jquery.js', + 'jsparty/jquery/plugins/livequery/jquery.livequery.js', + 'jsparty/jquery/plugins/effen/jquery.fn.js', + 'sapphire/javascript/core/jquery.ondemand.js', + 'jsparty/jquery/jquery_improvements.js', + 'jsparty/firebug/firebugx.js', + 'sapphire/javascript/i18n.js', + ) + ); + + Requirements::combine_files( + 'assets/leftandmain.js', + array( + 'jsparty/loader.js', + 'jsparty/hover.js', + 'jsparty/layout_helpers.js', + 'jsparty/scriptaculous/effects.js', + 'jsparty/scriptaculous/dragdrop.js', + 'jsparty/scriptaculous/controls.js', + 'jsparty/greybox/AmiJS.js', + 'jsparty/greybox/greybox.js', + 'cms/javascript/LeftAndMain.js', + 'cms/javascript/LeftAndMain_left.js', + 'cms/javascript/LeftAndMain_right.js', + //'jsparty/tiny_mce2/tiny_mce_src.js', + 'jsparty/tree/tree.js', + 'jsparty/tabstrip/tabstrip.js', + 'cms/javascript/TinyMCEImageEnhancement.js', + 'jsparty/SWFUpload/SWFUpload.js', + 'cms/javascript/Upload.js', + 'sapphire/javascript/TreeSelectorField.js', + 'cms/javascript/ThumbnailStripField.js', + ) + ); + + Requirements::combine_files( + 'assets/cmsmain.js', + array( + 'cms/javascript/CMSMain.js', + 'cms/javascript/CMSMain_left.js', + 'cms/javascript/CMSMain_right.js', + 'cms/javascript/SideTabs.js', + 'cms/javascript/SideReports.js', + 'cms/javascript/LangSelector.js', + 'cms/javascript/TranslationTab.js', + 'jsparty/calendar/calendar.js', + 'jsparty/calendar/lang/calendar-en.js', + 'jsparty/calendar/calendar-setup.js', + ) + ); // DEPRECATED 2.3: Use init() $dummy = null;