예제 #1
0
파일: index.php 프로젝트: clews/t3jquery
 /**
  * Initializes the Module
  */
 public 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 = \T3Ext\T3jquery\Utility\T3jqueryUtility::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 = \T3Ext\T3jquery\Utility\T3jqueryUtility::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 = \T3Ext\T3jquery\Utility\T3jqueryUtility::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 = \T3Ext\T3jquery\Utility\T3jqueryUtility::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 . \T3Ext\T3jquery\Utility\T3jqueryUtility::getJqPath();
     if (!is_dir($this->configDir)) {
         $this->configDir = PATH_site . 'uploads/tx_t3jquery/';
     }
     $this->createFolder();
     $this->initConfig();
     parent::init();
 }
예제 #2
0
    /**
     * Shows the update Message
     * @param $params
     * @param $tsObj
     * @return string
     */
    public function displayMessage(&$params, &$tsObj)
    {
        $out = '';
        if (T3jqueryUtility::getIntFromVersion(TYPO3_version) < 4003000) {
            // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here
            $cssPath = $GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('t3jquery');
            $out .= '<link rel="stylesheet" type="text/css" href="' . $cssPath . 'compat/flashmessages.css" media="screen" />';
        }
        // get all supported UI-Versions from folder
        $supportedUiVersions = GeneralUtility::get_dirs(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/ui/"));
        if (is_array($supportedUiVersions)) {
            foreach ($supportedUiVersions as $supportedUiVersion) {
                if (file_exists(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/ui/") . $supportedUiVersion . '/jquery.xml')) {
                    $this->supportedUiVersion[] = $supportedUiVersion;
                }
            }
        }
        // get all supported TOOLS-Versions from folder
        $supportedToolsVersions = GeneralUtility::get_dirs(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/tools/"));
        if (is_array($supportedToolsVersions)) {
            foreach ($supportedToolsVersions as $supportedToolsVersion) {
                if (file_exists(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/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 = GeneralUtility::_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 = T3jqueryUtility::getJqPath();
        }
        if ($this->checkConfig() === FALSE) {
            $out .= '
	<div class="typo3-message message-warning">
		<div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.checkConfigHeader') . '</div>
		<div class="message-body">
			' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/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/Resources/Private/Language/locallang.xml:extmng.updatermsgHeader') . '</div>
		<div class="message-body">
			' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.updatermsg') . '
		</div>
	</div>';
            }
            // Check if the library exists
            if (!file_exists(PATH_site . $configDir . T3jqueryUtility::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/Resources/Private/Language/locallang.xml:extmng.updatermsgHeader2') . '</div>
			<div class="message-body">
				' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.updatermsg2'), $configDir . T3jqueryUtility::getJqName()) . '
			</div>
		</div>
	</a>';
            }
        }
        $out = '<div style="position:absolute;top:10px;right:10px; width:300px;">' . $out . '</div>';
        return $out;
    }
예제 #3
0
 /**
  * Get the jquery script tag.
  * For backend usage only.
  * @param boolean $urlOnly If TRUE, only the URL is returned, not a full script tag
  * @return string HTML Script tag to load the jQuery JavaScript library
  */
 public static function getJqJSBE($urlOnly = FALSE)
 {
     $file = T3jqueryUtility::getJqPath() . T3jqueryUtility::getJqName();
     if (file_exists(PATH_site . $file)) {
         $url = GeneralUtility::resolveBackPath($GLOBALS['BACK_PATH'] . '../' . $file);
         if ($urlOnly) {
             return $url;
         } else {
             return '<script type="text/javascript" src="' . $url . '"></script>';
         }
     } else {
         GeneralUtility::devLog('\'' . T3jqueryUtility::getJqName() . '\' does not exists!', 't3jquery', 3);
     }
     return FALSE;
 }