From 9c9ec9d1f565788802cf3f673a7621e1ae320332 Mon Sep 17 00:00:00 2001 From: pollen8 Date: Thu, 6 Feb 2014 17:22:56 +0100 Subject: [PATCH] removing 2.5 rquirejs loading of calendarjs - caused errors if not in fabrik page, and loading of the two files should be sequential which is not guarenteed by loading with requirejs --- components/com_fabrik/jhelpers/2.5/behavior.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/com_fabrik/jhelpers/2.5/behavior.php b/components/com_fabrik/jhelpers/2.5/behavior.php index 869e8c883e2..bd26d852dd0 100644 --- a/components/com_fabrik/jhelpers/2.5/behavior.php +++ b/components/com_fabrik/jhelpers/2.5/behavior.php @@ -642,17 +642,25 @@ public static function calendar() { return; } + JHtml::_('stylesheet', 'system/calendar-jos.css', array(' title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), ' media' => 'all'), true); $translation = JHtmlBehavior::_calendartranslation(); $document = JFactory::getDocument(); $tag = JFactory::getLanguage()->getTag(); $app = JFactory::getApplication(); - if ($app->isAdmin()) + $option = $app->input->get('option'); + + // Bah - not sure why we were trying to load the calendar via requirejs + $isFabrik = $option == 'com_fabrik' || !is_null($app->input->get('fabrik_sticky_filters')); + $isFabrik = false; + + if ($app->isAdmin() || !$isFabrik) { $tag = JFactory::getLanguage()->getTag(); JHtml::_('script', $tag . '/calendar.js', false, true); JHtml::_('script', $tag . '/calendar-setup.js', false, true); + if ($translation) { $document->addScriptDeclaration($translation); @@ -660,18 +668,18 @@ public static function calendar() } else { - $f = array(); $f[] = JHtml::_('script', $tag . '/calendar.js', false, true, true); $f[] = JHtml::_('script', $tag . '/calendar-setup.js', false, true, true); + if ($translation) { + // In any event its not right as the 2 scrips would need to be loaded one after the other $translation = "requirejs(" . json_encode($f) . ", function () { $translation });\n"; $document->addScriptDeclaration($translation); } } - self::$loaded[__METHOD__] = true; }