Example #1
0
	/**
	 * Safe the file to disc
	 * 
	 * @param $block string
	 * @return void
	 */
	function safeJqFile($block='')
	{
		t3lib_div::writeFile($this->configDir . tx_t3jquery::getJqName(), $block);
	}
 /**
  * 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;
    }