/** * Initializes the Module * @return void */ function init() { // get extension configuration $this->confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); $this->configXML['groups'] = array(); $this->configXML['groups_missing'] = array(); // get the XML-Config from jQuery if ($this->confArray['jQueryVersion']) { $version = $this->confArray['jQueryVersion']; $array_name = 'groups'; } else { $version = $this->jQueryVersionOrig; $array_name = 'groups_missing'; } $this->jQueryConfig = tx_t3jquery::getJqueryConfiguration($version); if (count($this->jQueryConfig['groups']) > 0) { $this->configXML[$array_name] = $this->jQueryConfig['groups']; } // Get the XML-Config from jQuery UI if ($this->confArray['jQueryUiVersion']) { $version = $this->confArray['jQueryUiVersion']; $array_name = 'groups'; } else { $version = $this->jQueryUiVersionOrig; $array_name = 'groups_missing'; } $this->jQueryUiConfig = tx_t3jquery::getJqueryUiConfiguration($version); if (count($this->jQueryUiConfig['groups']) > 0) { foreach ($this->jQueryUiConfig['groups'] as $group) { $this->configXML[$array_name][] = $group; } } // Get the XML-Config from jQuery TOOLS if ($this->confArray['jQueryTOOLSVersion']) { $version = $this->confArray['jQueryTOOLSVersion']; $array_name = 'groups'; } else { $version = $this->jQueryTOOLSVersionOrig; $array_name = 'groups_missing'; } $this->jQueryTOOLSConfig = tx_t3jquery::getJqueryToolsConfiguration($version); if (count($this->jQueryTOOLSConfig['groups']) > 0) { foreach ($this->jQueryTOOLSConfig['groups'] as $group) { $this->configXML[$array_name][] = $group; } } // Get the XML-Config from jQuery Bootstrap if ($this->confArray['jQueryBootstrapVersion']) { $version = $this->confArray['jQueryBootstrapVersion']; $array_name = 'groups'; } else { $version = $this->jQueryBootstrapVersionOrig; $array_name = 'groups_missing'; } $this->jQueryBootstrapConfig = tx_t3jquery::getJqueryBootstrapConfiguration($version); if (count($this->jQueryBootstrapConfig['groups']) > 0) { foreach ($this->jQueryBootstrapConfig['groups'] as $group) { $this->configXML[$array_name][] = $group; } } // Define the language object $this->LANG = $GLOBALS['LANG']; // Define the used file directory $this->configDir = PATH_site . tx_t3jquery::getJqPath(); if (! is_dir($this->configDir)) { $this->configDir = PATH_site . 'uploads/tx_t3jquery/'; } $this->createFolder(); $this->initConfig(); parent::init(); }
/** * Get the jquery script tag. * For backend usage only. * @param boolean If TRUE, only the URL is returned, not a full script tag * @return string HTML Script tag to load the jQuery JavaScript library */ function getJqJSBE($urlOnly = FALSE) { $file = tx_t3jquery::getJqPath() . tx_t3jquery::getJqName(); if (file_exists(PATH_site . $file)) { $url = t3lib_div::resolveBackPath($GLOBALS['BACK_PATH'] . '../' . $file); if ($urlOnly) { return $url; } else { return '<script type="text/javascript" src="' . $url . '"></script>'; } } else { t3lib_div::devLog('\'' . tx_t3jquery::getJqName() . '\' does not exists!', 't3jquery', 3); } return FALSE; }
/** * Shows the update Message * @return string */ public function displayMessage(&$params, &$tsObj) { $out = ''; if (tx_t3jquery::getIntFromVersion(TYPO3_version) < 4003000) { // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('t3jquery'); $out .= '<link rel="stylesheet" type="text/css" href="' . $cssPath . 'compat/flashmessages.css" media="screen" />'; } // get all supported UI-Versions from folder $supportedUiVersions = t3lib_div::get_dirs(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/ui/")); if (is_array($supportedUiVersions)) { foreach ($supportedUiVersions as $supportedUiVersion) { if (file_exists(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/ui/") . $supportedUiVersion . '/jquery.xml')) { $this->supportedUiVersion[] = $supportedUiVersion; } } } // get all supported TOOLS-Versions from folder $supportedToolsVersions = t3lib_div::get_dirs(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/tools/")); if (is_array($supportedToolsVersions)) { foreach ($supportedToolsVersions as $supportedToolsVersion) { if (file_exists(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/tools/") . $supportedToolsVersion . '/jquery.xml')) { $this->supportedToolsVersion[] = $supportedToolsVersion; } } } // get the conf array $this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3jquery']); // if form is submited, the POST values are taken $post = t3lib_div::_POST(); if (count($post) > 0) { $jQueryUiVersion = $post['data']['jQueryUiVersion']; $jQueryToolsVersion = $post['data']['jQueryTOOLSVersion']; $jQueryVersion = $post['data']['jQueryVersion'] . "-" . $post['data']['jQueryUiVersion'] . ($post['data']['jQueryTOOLSVersion'] ? "-" . $post['data']['jQueryTOOLSVersion'] : ""); $configDir = $post['data']['configDir'] . (preg_match("/\\/\$/", $configDir) ? "" : "/"); } else { $jQueryUiVersion = $this->confArr['jQueryUiVersion']; $jQueryToolsVersion = $this->confArr['jQueryTOOLSVersion']; $jQueryVersion = T3JQUERYVERSION; $configDir = tx_t3jquery::getJqPath(); } if ($this->checkConfig() === FALSE) { $out .= ' <div class="typo3-message message-warning"> <div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.checkConfigHeader') . '</div> <div class="message-body"> ' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.checkConfig') . ' </div> </div>'; } elseif ($this->confArr['integrateFromCDN'] || $post['data']['integrateFromCDN']) { // Nothing to check } else { // check the actual version if ($jQueryUiVersion && !in_array($jQueryUiVersion, $this->supportedUiVersion) || $jQueryToolsVersion && !in_array($jQueryToolsVersion, $this->supportedToolsVersion)) { $out .= ' <div class="typo3-message message-information"> <div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsgHeader') . '</div> <div class="message-body"> ' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsg') . ' </div> </div>'; } // Check if the library exists if (!file_exists(PATH_site . $configDir . tx_t3jquery::getJqName())) { $out .= ' <a href="javascript:void();" onclick="top.goToModule(\'tools_txt3jqueryM1\',\'\',\'createLib=1\');this.blur();return false;"> <div class="typo3-message message-warning"> <div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsgHeader2') . '</div> <div class="message-body"> ' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsg2'), $configDir . tx_t3jquery::getJqName()) . ' </div> </div> </a>'; } } $out = '<div style="position:absolute;top:10px;right:10px; width:300px;">' . $out . '</div>'; return $out; }