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 <body> 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
This commit is contained in:
Ingo Schommer 2008-12-04 01:47:41 +00:00 committed by Sam Minnee
parent 9baf35d500
commit 9c81737a57
2 changed files with 58 additions and 58 deletions

View File

@ -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'),

View File

@ -183,6 +183,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;
$this->extend('augmentInit', $dummy);