示例#1
0
 /**
  * Render the facebook like viewhelper
  *
  * @return string
  */
 public function render()
 {
     $code = '';
     $url = !empty($this->arguments['href']) ? $this->arguments['href'] : t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
     // absolute urls are needed
     $this->tag->addAttribute('href', Tx_News_Utility_Url::prependDomain($url));
     $this->tag->forceClosingTag(TRUE);
     // -1 means no JS
     if ($this->arguments['javaScript'] != '-1') {
         if (empty($this->arguments['javaScript'])) {
             $tsSettings = $this->pluginSettingsService->getSettings();
             $locale = !empty($tsSettings['facebookLocale']) ? $tsSettings['facebookLocale'] : 'en_US';
             $code = '<script src="http://connect.facebook.net/' . $locale . '/all.js#xfbml=1"></script>';
             // Social interaction Google Analytics
             if ($this->pluginSettingsService->getByPath('analytics.social.facebookLike') == 1) {
                 $code .= t3lib_div::wrapJS("\n\t\t\t\t\t\tFB.Event.subscribe('edge.create', function(targetUrl) {\n\t\t\t\t\t\t \t_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tFB.Event.subscribe('edge.remove', function(targetUrl) {\n\t\t\t\t\t\t  _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]);\n\t\t\t\t\t\t});\n\t\t\t\t\t");
             }
         } else {
             $code = '<script src="' . htmlspecialchars($this->arguments['javaScript']) . '"></script>';
         }
     }
     // seems as if a div with id fb-root is needed this is just a dirty
     // workaround to make things work again Perhaps we should
     // use the iframe variation.
     $code .= '<div id="fb-root"></div>' . $this->tag->render();
     return $code;
 }
 /**
  * The uploadRTE section will be hidden
  * @return array
  */
 function hideRTE($PA, $fobj)
 {
     if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4004000) {
         $classes = array('.t3-form-field-label-flexsection', '.t3-form-field-toggle-flexsection', '.t3-form-field-container-flexsection', '.t3-form-field-add-flexsection');
         return t3lib_div::wrapJS("\$\$('" . implode(',', $classes) . "').each(function(n){n.hide();});");
     } elseif (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4003000) {
         return t3lib_div::wrapJS("\$\$('div.bgColor2').each(function(n){n.next(0).hide();n.next(1).hide();n.next(2).hide();n.hide();})");
     }
 }
 /**
  * @param string $content
  * @param bool $inline
  * @param bool $compress
  * @param bool $forceOnTop
  * @return void
  */
 public function render($compress = TRUE, $forceOnTop = FALSE)
 {
     $content = $this->renderChildren();
     if ($this->isCached()) {
         $this->pageRenderer->addJsFooterInlineCode(md5($content), $content, $compress, $forceOnTop);
     } else {
         // additionalFooterData not possible in USER_INT
         $GLOBALS['TSFE']->additionalHeaderData[md5($content)] = t3lib_div::wrapJS($content);
     }
 }
 /**
  * Render a share button
  *
  * @param boolean $loadJs
  * @return string
  */
 public function render($loadJs = TRUE)
 {
     // check defaults
     if (empty($this->arguments['href'])) {
         $this->tag->addAttribute('href', 'http://www.facebook.com/sharer.php');
     }
     if (empty($this->arguments['name'])) {
         $this->tag->addAttribute('name', 'fb_share');
     }
     if (empty($this->arguments['type'])) {
         $this->tag->addAttribute('type', 'button_count');
     }
     $shareUrl = empty($this->arguments['shareurl']) ? t3lib_div::getIndpEnv('TYPO3_REQUEST_URL') : $this->arguments['shareurl'];
     $this->tag->addAttribute('share_url', $shareUrl);
     $this->tag->removeAttribute('shareurl');
     $this->tag->setContent($this->renderChildren());
     $code = $this->tag->render();
     if ($loadJs) {
         $code .= '<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>';
     }
     // Social interaction Google Analytics
     if ($this->pluginSettingsService->getByPath('analytics.social.facebookShare') == 1) {
         $code .= t3lib_div::wrapJS("\r\n\t\t\t\tFB.Event.subscribe('message.send', function(targetUrl) {\r\n\t\t\t\t  _gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]);\r\n\t\t\t\t});\r\n\t\t\t");
     }
     return $code;
 }
 /**
  * Add inline code to the HTML
  * 
  * @param string $name
  * @param string $block
  * @param array $conf
  * @return void
  */
 function addJsInlineCode($name, $block, $conf = array())
 {
     if ($conf['jsinline']) {
         $GLOBALS['TSFE']->inlineJS['t3jquery.jsdata.' . $name] = $block;
     } elseif (tx_t3jquery::getIntFromVersion(TYPO3_version) >= 4003000) {
         $pagerender = $GLOBALS['TSFE']->getPageRenderer();
         if ($conf['tofooter'] == 'footer') {
             $pagerender->addJsFooterInlineCode($name, $block, $conf['compress'], $conf['forceOnTop']);
         } else {
             $pagerender->addJsInlineCode($name, $block, $conf['compress'], $conf['forceOnTop']);
         }
     } else {
         if ($conf['compress']) {
             $block = t3lib_div::minifyJavaScript($block);
         }
         if ($conf['tofooter'] == 'footer') {
             $GLOBALS['TSFE']->additionalFooterData['t3jquery.jsdata.' . $name] = t3lib_div::wrapJS($block, TRUE);
         } else {
             $GLOBALS['TSFE']->additionalHeaderData['t3jquery.jsdata.' . $name] = t3lib_div::wrapJS($block, TRUE);
         }
     }
 }
 function loadExtJS($filePath, $additionalCode = "")
 {
     if (!$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId]) {
         //prepare general script to be loaded into the Header
         $jsCodeArr = file(t3lib_extMgm::extPath('dr_wiki') . $filePath);
         // Add Configuration for JS-Script parts.
         $jsCode = $additionalCode;
         foreach ($jsCodeArr as $val) {
             $jsCode = $jsCode . $val;
         }
         $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId] = t3lib_div::wrapJS($jsCode);
     }
 }
示例#7
0
文件: index.php 项目: rod86/t3sandbox
    /**
     * Main function of the module.
     *
     * @return	void
     * @access public
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        $this->content = '';
        // Access check! The page will show only if there is a valid page and if this page may be viewed by the user
        if (is_array($this->altRoot)) {
            $access = true;
            // get PID of altRoot Element to get pageInfoArr
            $altRootRecord = t3lib_BEfunc::getRecordWSOL($this->altRoot['table'], $this->altRoot['uid'], 'pid');
            $pageInfoArr = t3lib_BEfunc::readPageAccess($altRootRecord['pid'], $this->perms_clause);
        } else {
            $pageInfoArr = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
            $access = intval($pageInfoArr['uid'] > 0);
        }
        if ($access) {
            if (t3lib_div::_GP('ajaxUnlinkRecord')) {
                $unlinkDestinationPointer = $this->apiObj->flexform_getPointerFromString(t3lib_div::_GP('ajaxUnlinkRecord'));
                $this->apiObj->unlinkElement($unlinkDestinationPointer);
            }
            $this->calcPerms = $this->getCalcPerms($pageInfoArr['uid']);
            // Define the root element record:
            $this->rootElementTable = is_array($this->altRoot) ? $this->altRoot['table'] : 'pages';
            $this->rootElementUid = is_array($this->altRoot) ? $this->altRoot['uid'] : $this->id;
            $this->rootElementRecord = t3lib_BEfunc::getRecordWSOL($this->rootElementTable, $this->rootElementUid, '*');
            if ($this->rootElementRecord['t3ver_swapmode'] == 0 && $this->rootElementRecord['_ORIG_uid']) {
                $this->rootElementUid_pidForContent = $this->rootElementRecord['_ORIG_uid'];
            } else {
                if ($this->rootElementRecord['t3ver_swapmode'] == -1 && $this->rootElementRecord['t3ver_oid'] && $this->rootElementRecord['pid'] < 0) {
                    // typo3 lacks a proper API to properly detect Offline versions and extract Live Versions therefore this is done by hand
                    if ($this->rootElementTable == 'pages') {
                        $this->rootElementUid_pidForContent = $this->rootElementRecord['t3ver_oid'];
                    } else {
                        $liveRec = t3lib_beFunc::getLiveRecord($this->rootElementTable, $this->rootElementUid);
                        $this->rootElementUid_pidForContent = $liveRec['pid'];
                    }
                } else {
                    // If pages use current UID, otherwhise you must use the PID to define the Page ID
                    if ($this->rootElementTable == 'pages') {
                        $this->rootElementUid_pidForContent = $this->rootElementRecord['uid'];
                    } else {
                        $this->rootElementUid_pidForContent = $this->rootElementRecord['pid'];
                    }
                }
            }
            // Check if we have to update the pagetree:
            if (t3lib_div::_GP('updatePageTree')) {
                t3lib_BEfunc::setUpdateSignal('updatePageTree');
            }
            // Draw the header.
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('EXT:templavoila/resources/templates/mod1_default.html');
            $this->doc->docType = 'xhtml_trans';
            $this->doc->bodyTagId = 'typo3-mod-php';
            $this->doc->divClass = '';
            $this->doc->form = '<form action="' . htmlspecialchars('index.php?' . $this->link_getParameters()) . '" method="post">';
            // Add custom styles
            $styleSheetFile = t3lib_extMgm::extPath($this->extKey) . 'mod1/pagemodule_' . substr(TYPO3_version, 0, 3) . '.css';
            if (file_exists($styleSheetFile)) {
                $styleSheetFile = t3lib_extMgm::extRelPath($this->extKey) . 'mod1/pagemodule_' . substr(TYPO3_version, 0, 3) . '.css';
            } else {
                $styleSheetFile = t3lib_extMgm::extRelPath($this->extKey) . 'mod1/pagemodule.css';
            }
            if (isset($this->modTSconfig['properties']['stylesheet'])) {
                $styleSheetFile = $this->modTSconfig['properties']['stylesheet'];
            }
            $this->doc->getPageRenderer()->addCssFile($GLOBALS['BACK_PATH'] . $styleSheetFile);
            if (isset($this->modTSconfig['properties']['stylesheet.'])) {
                foreach ($this->modTSconfig['properties']['stylesheet.'] as $file) {
                    if (substr($file, 0, 4) == 'EXT:') {
                        list($extKey, $local) = explode('/', substr($file, 4), 2);
                        $filename = '';
                        if (strcmp($extKey, '') && t3lib_extMgm::isLoaded($extKey) && strcmp($local, '')) {
                            $file = t3lib_extMgm::extRelPath($extKey) . $local;
                        }
                    }
                    $this->doc->getPageRenderer()->addCssFile($GLOBALS['BACK_PATH'] . $file);
                }
            }
            // Adding classic jumpToUrl function, needed for the function menu. Also, the id in the parent frameset is configured.
            $this->doc->JScode = $this->doc->wrapScriptTags('
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
				' . $this->doc->redirectUrls() . '
				var T3_TV_MOD1_BACKPATH = "' . $BACK_PATH . '";
				var T3_TV_MOD1_RETURNURL = "' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '";
			');
            $this->doc->getPageRenderer()->loadExtJs();
            $this->doc->JScode .= $this->doc->wrapScriptTags('
				var typo3pageModule = {
					/**
					 * Initialization
					 */
					init: function() {
						typo3pageModule.enableHighlighting();
					},

					/**
					 * This method is used to bind the higlighting function "setActive"
					 * to the mouseenter event and the "setInactive" to the mouseleave event.
					 */
					enableHighlighting: function() {
						Ext.get(\'typo3-docbody\')
							.on(\'mouseover\', typo3pageModule.setActive,typo3pageModule);
					},

					/**
					 * This method is used as an event handler when the
					 * user hovers the a content element.
					 */
					setActive: function(e, t) {
						Ext.select(\'.active\').removeClass(\'active\').addClass(\'inactive\');
						var parent = Ext.get(t).findParent(\'.t3-page-ce\', null, true);
						if (parent) {
							parent.removeClass(\'inactive\').addClass(\'active\');
						}
					}
				}

				Ext.onReady(function() {
					typo3pageModule.init();
				});
			');
            // Preparing context menues
            // this also adds prototype to the list of required libraries
            $CMparts = $this->doc->getContextMenuCode();
            $mod1_file = 'dragdrop' . ($this->debug ? '.js' : '-min.js');
            if (method_exists('t3lib_div', 'createVersionNumberedFilename')) {
                $mod1_file = t3lib_div::createVersionNumberedFilename($mod1_file);
            } else {
                $mod1_file .= '?' . filemtime(t3lib_extMgm::extPath('templavoila') . 'mod1/' . $mod1_file);
            }
            //Prototype /Scriptaculous
            // prototype is loaded before, so no need to include twice.
            $this->doc->JScodeLibArray['scriptaculous'] = '<script src="' . $this->doc->backPath . 'contrib/scriptaculous/scriptaculous.js?load=effects,dragdrop,builder" type="text/javascript"></script>';
            $this->doc->JScodeLibArray['templavoila_mod1'] = '<script src="' . $this->doc->backPath . '../' . t3lib_extMgm::siteRelPath('templavoila') . 'mod1/' . $mod1_file . '" type="text/javascript"></script>';
            if (isset($this->modTSconfig['properties']['javascript.']) && is_array($this->modTSconfig['properties']['javascript.'])) {
                // add custom javascript files
                foreach ($this->modTSconfig['properties']['javascript.'] as $key => $value) {
                    if ($value) {
                        if (substr($value, 0, 4) == 'EXT:') {
                            list($extKey, $local) = explode('/', substr($value, 4), 2);
                            $filename = '';
                            if (strcmp($extKey, '') && t3lib_extMgm::isLoaded($extKey) && strcmp($local, '')) {
                                $value = t3lib_extMgm::extRelPath($extKey) . $local;
                            }
                        }
                        $this->doc->JScodeLibArray[$key] = '<script src="' . $this->doc->backPath . htmlspecialchars($value) . '" type="text/javascript"></script>';
                    }
                }
            }
            // Set up JS for dynamic tab menu and side bar
            if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) {
                $this->doc->JScode .= $this->doc->getDynTabMenuJScode();
            } else {
                $this->doc->loadJavascriptLib('js/tabmenu.js');
            }
            $this->doc->JScode .= $this->modTSconfig['properties']['sideBarEnable'] ? $this->sideBarObj->getJScode() : '';
            // Setting up support for context menus (when clicking the items icon)
            $this->doc->bodyTagAdditions = $CMparts[1];
            $this->doc->JScode .= $CMparts[0];
            $this->doc->postCode .= $CMparts[2];
            // CSS for drag and drop
            if (t3lib_extMgm::isLoaded('t3skin')) {
                // Fix padding for t3skin in disabled tabs
                $this->doc->inDocStyles .= '
					table.typo3-dyntabmenu td.disabled, table.typo3-dyntabmenu td.disabled_over, table.typo3-dyntabmenu td.disabled:hover { padding-left: 10px; }
				';
            }
            $this->handleIncomingCommands();
            // Start creating HTML output
            $render_editPageScreen = true;
            // Show message if the page is of a special doktype:
            if ($this->rootElementTable == 'pages') {
                // Initialize the special doktype class:
                $specialDoktypesObj =& t3lib_div::getUserObj('&tx_templavoila_mod1_specialdoktypes', '');
                $specialDoktypesObj->init($this);
                $doktype = $this->rootElementRecord['doktype'];
                // if doktype is configured as editType render normal edit view
                $docTypesToEdit = $this->modTSconfig['properties']['additionalDoktypesRenderToEditView'];
                if ($docTypesToEdit && t3lib_div::inList($docTypesToEdit, $doktype)) {
                    //Make sure it is editable by page module
                    $doktype = self::DOKTYPE_NORMAL_EDIT;
                }
                $methodName = 'renderDoktype_' . $doktype;
                if (method_exists($specialDoktypesObj, $methodName)) {
                    $result = $specialDoktypesObj->{$methodName}($this->rootElementRecord);
                    if ($result !== FALSE) {
                        $this->content .= $result;
                        if ($GLOBALS['BE_USER']->isPSet($this->calcPerms, 'pages', 'edit')) {
                            // Edit icon only if page can be modified by user
                            $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage')));
                            $this->content .= '<br/><br/><strong>' . $this->link_edit($iconEdit . $LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage'), 'pages', $this->id) . '</strong>';
                        }
                        $render_editPageScreen = false;
                        // Do not output editing code for special doctypes!
                    }
                }
            }
            if ($render_editPageScreen) {
                $editCurrentPageHTML = '';
                // warn if page renders content from other page
                if ($this->rootElementRecord['content_from_pid']) {
                    $contentPage = t3lib_BEfunc::getRecord('pages', intval($this->rootElementRecord['content_from_pid']));
                    $title = t3lib_BEfunc::getRecordTitle('pages', $contentPage);
                    $linkToPid = 'index.php?id=' . intval($this->rootElementRecord['content_from_pid']);
                    $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->rootElementRecord['content_from_pid']) . ')</a>';
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', sprintf($LANG->getLL('content_from_pid_title'), $link), t3lib_FlashMessage::INFO);
                    $editCurrentPageHTML = '';
                    t3lib_FlashMessageQueue::addMessage($flashMessage);
                }
                // Render "edit current page" (important to do before calling ->sideBarObj->render() - otherwise the translation tab is not rendered!
                $editCurrentPageHTML .= $this->render_editPageScreen();
                if (t3lib_div::_GP('ajaxUnlinkRecord')) {
                    $this->render_editPageScreen();
                    echo $this->render_sidebar();
                    exit;
                }
                $this->content .= $editCurrentPageHTML;
                // Create sortables
                if (is_array($this->sortableContainers)) {
                    $script = '';
                    $sortable_items_json = json_encode($this->sortableItems);
                    $all_items_json = json_encode($this->allItems);
                    $script .= 'var all_items = ' . $all_items_json . ';' . 'var sortable_items = ' . $sortable_items_json . ';' . 'var sortable_removeHidden = ' . ($this->MOD_SETTINGS['tt_content_showHidden'] !== '0' ? 'false;' : 'true;') . 'var sortable_linkParameters = \'' . $this->link_getParameters() . '\';';
                    $containment = '[' . t3lib_div::csvValues($this->sortableContainers, ',', '"') . ']';
                    $script .= 'Event.observe(window,"load",function(){';
                    foreach ($this->sortableContainers as $s) {
                        $script .= 'tv_createSortable(\'' . $s . '\',' . $containment . ');';
                    }
                    $script .= '});';
                    $this->content .= t3lib_div::wrapJS($script);
                }
                $this->doc->divClass = 'tpm-editPageScreen';
            }
        } else {
            // No access or no current page uid:
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('EXT:templavoila/resources/templates/mod1_noaccess.html');
            $this->doc->docType = 'xhtml_trans';
            $this->doc->bodyTagId = 'typo3-mod-php';
            $cmd = t3lib_div::_GP('cmd');
            switch ($cmd) {
                // Create a new page
                case 'crPage':
                    // Output the page creation form
                    $this->content .= $this->wizardsObj->renderWizard_createNewPage(t3lib_div::_GP('positionPid'));
                    break;
                    // If no access or if ID == zero
                // If no access or if ID == zero
                default:
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('default_introduction'), $LANG->getLL('title'), t3lib_FlashMessage::INFO);
                    $this->content .= $flashMessage->render();
            }
        }
        // Place content inside template
        $content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
        $content .= $this->doc->moduleBody(array(), $this->getDocHeaderButtons(), $this->getBodyMarkers());
        $content .= $this->doc->endPage();
        // Replace content with templated content
        $this->content = $content;
    }
 /**
  * Include all defined resources (JS / CSS)
  *
  * @return void
  */
 public function addResources()
 {
     if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4003000) {
         $pagerender = $GLOBALS['TSFE']->getPageRenderer();
     }
     // Fix moveJsFromHeaderToFooter (add all scripts to the footer)
     if ($GLOBALS['TSFE']->config['config']['moveJsFromHeaderToFooter']) {
         $allJsInFooter = TRUE;
     } else {
         $allJsInFooter = FALSE;
     }
     // add all defined JS files
     if (count($this->jsFiles) > 0) {
         foreach ($this->jsFiles as $jsToLoad) {
             if (T3JQUERY === TRUE) {
                 $conf = array('jsfile' => $jsToLoad, 'tofooter' => $this->conf['jsInFooter'] || $allJsInFooter, 'jsminify' => $this->conf['jsMinify']);
                 tx_t3jquery::addJS('', $conf);
             } else {
                 $file = $this->getPath($jsToLoad);
                 if ($file) {
                     if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4003000) {
                         if ($this->conf['jsInFooter'] || $allJsInFooter) {
                             $pagerender->addJsFooterFile($file, 'text/javascript', $this->conf['jsMinify']);
                         } else {
                             $pagerender->addJsFile($file, 'text/javascript', $this->conf['jsMinify']);
                         }
                     } else {
                         $temp_file = '<script type="text/javascript" src="' . $file . '"></script>';
                         if ($this->conf['jsInFooter'] || $allJsInFooter) {
                             $GLOBALS['TSFE']->additionalFooterData['jsFile_' . $this->extKey . '_' . $file] = $temp_file;
                         } else {
                             $GLOBALS['TSFE']->additionalHeaderData['jsFile_' . $this->extKey . '_' . $file] = $temp_file;
                         }
                     }
                 } else {
                     t3lib_div::devLog("'{$jsToLoad}' does not exists!", $this->extKey, 2);
                 }
             }
         }
     }
     // add all defined JS script
     if (count($this->js) > 0) {
         foreach ($this->js as $jsToPut) {
             $temp_js .= $jsToPut;
         }
         $conf = array();
         $conf['jsdata'] = $temp_js;
         if (T3JQUERY === TRUE && class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger($this->getExtensionVersion('t3jquery')) >= 1002000) {
             $conf['tofooter'] = $this->conf['jsInFooter'] || $allJsInFooter;
             $conf['jsminify'] = $this->conf['jsMinify'];
             $conf['jsinline'] = $this->conf['jsInline'];
             tx_t3jquery::addJS('', $conf);
         } else {
             // Add script only once
             $hash = md5($temp_js);
             if ($this->conf['jsInline']) {
                 $GLOBALS['TSFE']->inlineJS[$hash] = $temp_js;
             } elseif (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4003000) {
                 if ($this->conf['jsInFooter'] || $allJsInFooter) {
                     $pagerender->addJsFooterInlineCode($hash, $temp_js, $this->conf['jsMinify']);
                 } else {
                     $pagerender->addJsInlineCode($hash, $temp_js, $this->conf['jsMinify']);
                 }
             } else {
                 if ($this->conf['jsMinify']) {
                     $temp_js = t3lib_div::minifyJavaScript($temp_js);
                 }
                 if ($this->conf['jsInFooter'] || $allJsInFooter) {
                     $GLOBALS['TSFE']->additionalFooterData['js_' . $this->extKey . '_' . $hash] = t3lib_div::wrapJS($temp_js, TRUE);
                 } else {
                     $GLOBALS['TSFE']->additionalHeaderData['js_' . $this->extKey . '_' . $hash] = t3lib_div::wrapJS($temp_js, TRUE);
                 }
             }
         }
     }
     // add all defined CSS files
     if (count($this->cssFiles) > 0) {
         foreach ($this->cssFiles as $cssToLoad) {
             // Add script only once
             $file = $this->getPath($cssToLoad);
             if ($file) {
                 if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4003000) {
                     $pagerender->addCssFile($file, 'stylesheet', 'all', '', $this->conf['cssMinify']);
                 } else {
                     $GLOBALS['TSFE']->additionalHeaderData['cssFile_' . $this->extKey . '_' . $file] = '<link rel="stylesheet" type="text/css" href="' . $file . '" media="all" />' . chr(10);
                 }
             } else {
                 t3lib_div::devLog("'{$cssToLoad}' does not exists!", $this->extKey, 2);
             }
         }
     }
     // add all defined CSS files for IE
     if (count($this->cssFilesInc) > 0) {
         foreach ($this->cssFilesInc as $cssToLoad) {
             // Add script only once
             $file = $this->getPath($cssToLoad['file']);
             if ($file) {
                 // Theres no possibility to add conditions for IE by pagerenderer, so this will be added in additionalHeaderData
                 $GLOBALS['TSFE']->additionalHeaderData['cssFile_' . $this->extKey . '_' . $file] = '<!--[if ' . $cssToLoad['rule'] . ']><link rel="stylesheet" type="text/css" href="' . $file . '" media="all" /><![endif]-->' . chr(10);
             } else {
                 t3lib_div::devLog("'{$cssToLoad['file']}' does not exists!", $this->extKey, 2);
             }
         }
     }
     // add all defined CSS Script
     if (count($this->css) > 0) {
         foreach ($this->css as $cssToPut) {
             $temp_css .= $cssToPut;
         }
         $hash = md5($temp_css);
         if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4003000) {
             $pagerender->addCssInlineBlock($hash, $temp_css, $this->conf['cssMinify']);
         } else {
             // addCssInlineBlock
             $GLOBALS['TSFE']->additionalCSS['css_' . $this->extKey . '_' . $hash] .= $temp_css;
         }
     }
 }
    /**
     * Get the form for extension configuration
     *
     * @param  string  $cat
     * @param  array $theConstants
     * @param  string  $script
     * @param  string $addFields
     * @param  string $extKey
     * @param  bool  Adds opening <form> tag to the ouput, if TRUE
     * @return  string the form
     */
    function ext_getForm($cat, $theConstants, $script = "", $addFields = "", $extKey = "", $addFormTag = TRUE)
    {
        $this->ext_makeHelpInformationForCategory($cat);
        $printFields = trim($this->ext_printFields($theConstants, $cat));
        $content = '';
        $content .= t3lib_div::wrapJS('
			function uFormUrl(aname) {
				document.' . $this->ext_CEformName . '.action = "' . t3lib_div::linkThisScript() . '#"+aname;
			}
		');
        if ($addFormTag) {
            $content .= '<form action="' . htmlspecialchars($script ? $script : t3lib_div::linkThisScript()) . '" name="' . $this->ext_CEformName . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        }
        $content .= $addFields;
        $content .= $printFields;
        $content .= '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsfe.xml:update', TRUE) . '" id="configuration-submit-' . htmlspecialchars($extKey) . '" />';
        $example = $this->ext_displayExample();
        $content .= $example ? '<hr/>' . $example : "";
        return $content;
    }
    /**
     * [Describe function...]
     *
     * @param	[type]		$cat: ...
     * @param	[type]		$theConstants: ...
     * @param	[type]		$script: ...
     * @param	[type]		$addFields: ...
     * @return	[type]		...
     */
    function ext_getForm($cat, $theConstants, $script = "", $addFields = "")
    {
        $this->ext_makeHelpInformationForCategory($cat);
        $printFields = trim($this->ext_printFields($theConstants, $cat));
        $content = '';
        $content .= t3lib_div::wrapJS('
			function uFormUrl(aname) {
				document.' . $this->ext_CEformName . '.action = "' . t3lib_div::linkThisScript() . '#"+aname;
			}
		');
        $content .= '<form action="' . htmlspecialchars($script ? $script : t3lib_div::linkThisScript()) . '" name="' . $this->ext_CEformName . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        $content .= $addFields;
        $content .= $printFields;
        $content .= '<input type="Submit" name="submit" value="Update" />';
        $example = $this->ext_displayExample();
        $content .= $example ? '<hr/>' . $example : "";
        return $content;
    }
 public function getModeSpecificJavascriptCode()
 {
     if (empty($this->mode)) {
         return '';
     }
     $path_t3e = $GLOBALS['BACK_PATH'] . t3lib_extmgm::extRelPath('t3editor');
     $content = '';
     if ($this->mode === self::MODE_TYPOSCRIPT) {
         $content .= '<script type="text/javascript" src="' . $path_t3e . 'res/jslib/ts_codecompletion/tsref.js' . '"></script>';
         $content .= '<script type="text/javascript" src="' . $path_t3e . 'res/jslib/ts_codecompletion/completionresult.js' . '"></script>';
         $content .= '<script type="text/javascript" src="' . $path_t3e . 'res/jslib/ts_codecompletion/tsparser.js' . '"></script>';
         $content .= '<script type="text/javascript" src="' . $path_t3e . 'res/jslib/ts_codecompletion/tscodecompletion.js' . '"></script>';
     }
     $content .= t3lib_div::wrapJS('T3editor.parserfile = ' . $this->getParserfileByMode($this->mode) . ';' . LF . 'T3editor.stylesheet = ' . $this->getStylesheetByMode($this->mode) . ';');
     return $content;
 }
 /**
  * Render twitter viewhelper
  *
  * @return string
  */
 public function render()
 {
     $code = '';
     $this->tag->addAttribute('href', 'http://twitter.com/share');
     $this->tag->addAttribute('class', !empty($this->arguments['class']) ? $this->arguments['class'] : 'twitter-share-button');
     // rewrite tags as it seems that it is not possible to have tags with a '-'.
     $rewriteTags = array('datacount', 'datavia', 'datarelated', 'datatext', 'dataurl', 'datalang');
     foreach ($rewriteTags as $tag) {
         if (!empty($this->arguments[$tag])) {
             $newTag = str_replace('data', 'data-', $tag);
             $this->tag->addAttribute($newTag, $this->arguments[$tag]);
             $this->tag->removeAttribute($tag);
         }
     }
     // -1 means no JS
     if ($this->arguments['javaScript'] != '-1') {
         if (empty($this->arguments['javaScript'])) {
             $code = '<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>';
         } else {
             $code = '<script src="' . htmlspecialchars($this->arguments['javaScript']) . '"></script>';
         }
     }
     // Social interaction Google Analytics
     if ($this->pluginSettingsService->getByPath('analytics.social.twitter') == 1) {
         $code .= t3lib_div::wrapJS("\r\n\t\t\t\ttwttr.events.bind('tweet', function(event) {\r\n\t\t\t\t  if (event) {\r\n\t\t\t\t    var targetUrl;\r\n\t\t\t\t    if (event.target && event.target.nodeName == 'IFRAME') {\r\n\t\t\t\t      targetUrl = extractParamFromUri(event.target.src, 'url');\r\n\t\t\t\t    }\r\n\t\t\t\t    _gaq.push(['_trackSocial', 'twitter', 'tweet', targetUrl]);\r\n\t\t\t\t  }\r\n\t\t\t\t});\r\n\t\t\t");
     }
     $this->tag->removeAttribute('javaScript');
     $this->tag->setContent($this->renderChildren());
     $code = $this->tag->render() . $code;
     return $code;
 }
示例#13
0
 /**
  * Injects $code in header data
  *
  * @param string $code A rendered tag suitable for <head>
  * @param string $type Optional, if left out we assume the code is already wrapped
  * @param string $key Optional key for referencing later through $GLOBALS['TSFE']->additionalHeaderData, defaults to md5 cheksum of tag
  * @param int $index Position to take in additionalHeaderData; pushes current resident DOWN
  * @param array $attributes Attributes of tag
  * @deprecated
  */
 public function includeHeader($code, $type = NULL, $key = NULL, $index = -1, $attributes = NULL)
 {
     if ($key === NULL) {
         $key = md5($code);
     }
     if ($type == 'js') {
         if ($this->isCached()) {
             $this->pageRenderer->addJsInlineCode($key, $code, FALSE, $index == 0);
         } else {
             $GLOBALS['TSFE']->additionalHeaderData[md5($key)] = t3lib_div::wrapJS($code);
         }
     } elseif ($type == 'css') {
         if ($this->isCached()) {
             $this->pageRenderer->addCssInlineBlock($key, $code, FALSE, $index == 0);
         } else {
             $GLOBALS['TSFE']->additionalHeaderData[md5($key)] = '<style type="text/css">' . $code . '</style>';
         }
     }
 }
    /**
     * Opens a debug message inside a popup window
     *
     * @param mixed $debugVariable
     * @param string $header
     * @param string $group
     */
    public static function debugInPopUpWindow($debugVariable, $header = 'Debug', $group = 'Debug')
    {
        $debugString = self::prepareVariableForJavascript(self::convertVariableToString($debugVariable), is_object($debugVariable));
        $script = '
			(function debug() {
				var debugMessage = "' . $debugString . '",
					header = "' . htmlspecialchars($header) . '",
					group = "' . htmlspecialchars($group) . '",

					browserWindow = function(debug, header, group) {
						var newWindow = window.open("", "TYPO3DebugWindow_" + group,
							"width=600,height=400,menubar=0,toolbar=1,status=0,scrollbars=1,resizable=1"
						);
						if (newWindow.document.body.innerHTML) {
							newWindow.document.body.innerHTML = newWindow.document.body.innerHTML +
								"<hr />" + debugMessage;
						} else {
							newWindow.document.writeln(
								"<html><head><title>Debug: " + header + "(" + group + ")</title></head>"
								+ "<body onload=\\"self.focus()\\">"
								+ debugMessage
								+ "</body></html>"
							);
						}
					}

				if (!top.Ext) {
					browserWindow(debugMessage, header, group);
				} else {
					top.Ext.onReady(function() {
						if (top && top.TYPO3 && top.TYPO3.Backend) {
							top.TYPO3.Backend.DebugConsole.openBrowserWindow(header, debugMessage, group);
						} else {
							browserWindow(debugMessage, header, group);
						}
					});
				}
			})();
		';
        echo t3lib_div::wrapJS($script);
    }
    /**
     * JavaScript code used for input-field evaluation.
     *
     *		 Example use:
     *
     *		 $msg .= 'Distribution time (hh:mm dd-mm-yy):<br /><input type="text" name="send_mail_datetime_hr" onchange="typo3form.fieldGet(\'send_mail_datetime\', \'datetime\', \'\', 0,0);"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' /><input type="hidden" value="' . $GLOBALS['EXEC_TIME'] . '" name="send_mail_datetime" /><br />';
     *		 $this->extJSCODE.='typo3form.fieldSet("send_mail_datetime", "datetime", "", 0,0);';
     *
     *		 ... and then include the result of this function after the form
     *
     * @param	string		$formname: The identification of the form on the page.
     * @param	boolean		$update: Just extend/update existing settings, e.g. for AJAX call
     * @return	string		A section with JavaScript - if $update is false, embedded in <script></script>
     */
    function JSbottom($formname = 'forms[0]', $update = FALSE)
    {
        $jsFile = array();
        $elements = array();
        // required:
        foreach ($this->requiredFields as $itemImgName => $itemName) {
            $match = array();
            if (preg_match('/^(.+)\\[((\\w|\\d|_)+)\\]$/', $itemName, $match)) {
                $record = $match[1];
                $field = $match[2];
                $elements[$record][$field]['required'] = 1;
                $elements[$record][$field]['requiredImg'] = $itemImgName;
                if (isset($this->requiredAdditional[$itemName]) && is_array($this->requiredAdditional[$itemName])) {
                    $elements[$record][$field]['additional'] = $this->requiredAdditional[$itemName];
                }
            }
        }
        // range:
        foreach ($this->requiredElements as $itemName => $range) {
            if (preg_match('/^(.+)\\[((\\w|\\d|_)+)\\]$/', $itemName, $match)) {
                $record = $match[1];
                $field = $match[2];
                $elements[$record][$field]['range'] = array($range[0], $range[1]);
                $elements[$record][$field]['rangeImg'] = $range['imgName'];
            }
        }
        $this->TBE_EDITOR_fieldChanged_func = 'TBE_EDITOR.fieldChanged_fName(fName,formObj[fName+"_list"]);';
        if (!$update) {
            if ($this->loadMD5_JS) {
                $this->loadJavascriptLib('md5.js');
            }
            /** @var $pageRenderer t3lib_PageRenderer */
            $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
            $pageRenderer->loadPrototype();
            $pageRenderer->loadExtJS();
            // make textareas resizable and flexible
            if (!($GLOBALS['BE_USER']->uc['resizeTextareas'] == '0' && $GLOBALS['BE_USER']->uc['resizeTextareas_Flexible'] == '0')) {
                $pageRenderer->addCssFile($this->backPath . '../t3lib/js/extjs/ux/resize.css');
                $this->loadJavascriptLib('../t3lib/js/extjs/ux/ext.resizable.js');
            }
            $resizableSettings = array('textareaMaxHeight' => $GLOBALS['BE_USER']->uc['resizeTextareas_MaxHeight'] > 0 ? $GLOBALS['BE_USER']->uc['resizeTextareas_MaxHeight'] : '600', 'textareaFlexible' => !$GLOBALS['BE_USER']->uc['resizeTextareas_Flexible'] == '0', 'textareaResize' => !$GLOBALS['BE_USER']->uc['resizeTextareas'] == '0');
            $pageRenderer->addInlineSettingArray('', $resizableSettings);
            $this->loadJavascriptLib('../t3lib/jsfunc.evalfield.js');
            $this->loadJavascriptLib('jsfunc.tbe_editor.js');
            // needed for tceform manipulation (date picker)
            $typo3Settings = array('datePickerUSmode' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? 1 : 0, 'dateFormat' => array('j-n-Y', 'G:i j-n-Y'), 'dateFormatUS' => array('n-j-Y', 'G:i n-j-Y'));
            $pageRenderer->addInlineSettingArray('', $typo3Settings);
            $this->loadJavascriptLib('../t3lib/js/extjs/tceforms.js');
            // if IRRE fields were processed, add the JavaScript functions:
            if ($this->inline->inlineCount) {
                $GLOBALS['SOBE']->doc->getPageRenderer()->loadScriptaculous();
                $this->loadJavascriptLib('../t3lib/jsfunc.inline.js');
                $out .= '
				inline.setPrependFormFieldNames("' . $this->inline->prependNaming . '");
				inline.setNoTitleString("' . addslashes(t3lib_BEfunc::getNoRecordTitle(TRUE)) . '");
				';
            }
            // if Suggest fields were processed, add the JS functions
            if ($this->suggest->suggestCount > 0) {
                $pageRenderer->loadScriptaculous();
                $this->loadJavascriptLib('../t3lib/js/jsfunc.tceforms_suggest.js');
            }
            // Toggle icons:
            $toggleIcon_open = t3lib_iconWorks::getSpriteIcon('actions-move-down', array('title' => 'Open'));
            $toggleIcon_close = t3lib_iconWorks::getSpriteIcon('actions-move-right', array('title' => 'Close'));
            $out .= '
			function getOuterHTML(idTagPrefix)	{	// Function getting the outerHTML of an element with id
				var str=($(idTagPrefix).inspect()+$(idTagPrefix).innerHTML+"</"+$(idTagPrefix).tagName.toLowerCase()+">");
				return str;
			}
			function flexFormToggle(id)	{	// Toggling flexform elements on/off:
				Element.toggle(""+id+"-content");

				if (Element.visible(id+"-content")) {
					$(id+"-toggle").update(\'' . $toggleIcon_open . '\');
					$(id+"-toggleClosed").value = 0;
				} else {
					$(id+"-toggle").update(\'' . $toggleIcon_close . '\');
					$(id+"-toggleClosed").value = 1;
				}

				var previewContent = "";
				var children = $(id+"-content").getElementsByTagName("input");
				for (var i = 0, length = children.length; i < length; i++) {
					if (children[i].type=="text" && children[i].value)	previewContent+= (previewContent?" / ":"")+children[i].value;
				}
				if (previewContent.length>80)	{
					previewContent = previewContent.substring(0,67)+"...";
				}
				$(id+"-preview").update(previewContent);
			}
			function flexFormToggleSubs(id)	{	// Toggling sub flexform elements on/off:
				var descendants = $(id).immediateDescendants();
				var isOpen=0;
				var isClosed=0;
					// Traverse and find how many are open or closed:
				for (var i = 0, length = descendants.length; i < length; i++) {
					if (descendants[i].id)	{
						if (Element.visible(descendants[i].id+"-content"))	{isOpen++;} else {isClosed++;}
					}
				}

					// Traverse and toggle
				for (var i = 0, length = descendants.length; i < length; i++) {
					if (descendants[i].id)	{
						if (isOpen!=0 && isClosed!=0)	{
							if (Element.visible(descendants[i].id+"-content"))	{flexFormToggle(descendants[i].id);}
						} else {
							flexFormToggle(descendants[i].id);
						}
					}
				}
			}
			function flexFormSortable(id)	{	// Create sortables for flexform sections
				Position.includeScrollOffsets = true;
 				Sortable.create(id, {tag:\'div\',constraint: false, onChange:function(){
					setActionStatus(id);
				} });
			}
			function setActionStatus(id)	{	// Updates the "action"-status for a section. This is used to move and delete elements.
				var descendants = $(id).immediateDescendants();

					// Traverse and find how many are open or closed:
				for (var i = 0, length = descendants.length; i < length; i++) {
					if (descendants[i].id)	{
						$(descendants[i].id+"-action").value = descendants[i].visible() ? i : "DELETE";
					}
				}
			}

			TBE_EDITOR.images.req.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/required_h.gif', '', 1) . '";
			TBE_EDITOR.images.cm.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/content_client.gif', '', 1) . '";
			TBE_EDITOR.images.sel.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/content_selected.gif', '', 1) . '";
			TBE_EDITOR.images.clear.src = "' . $this->backPath . 'clear.gif";

			TBE_EDITOR.auth_timeout_field = ' . intval($GLOBALS['BE_USER']->auth_timeout_field) . ';
			TBE_EDITOR.formname = "' . $formname . '";
			TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
			TBE_EDITOR.backPath = "' . addslashes($this->backPath) . '";
			TBE_EDITOR.prependFormFieldNames = "' . $this->prependFormFieldNames . '";
			TBE_EDITOR.prependFormFieldNamesUENC = "' . rawurlencode($this->prependFormFieldNames) . '";
			TBE_EDITOR.prependFormFieldNamesCnt = ' . substr_count($this->prependFormFieldNames, '[') . ';
			TBE_EDITOR.isPalettedoc = ' . ($this->isPalettedoc ? addslashes($this->isPalettedoc) : 'null') . ';
			TBE_EDITOR.doSaveFieldName = "' . ($this->doSaveFieldName ? addslashes($this->doSaveFieldName) : '') . '";
			TBE_EDITOR.labels.fieldsChanged = ' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.fieldsChanged')) . ';
			TBE_EDITOR.labels.fieldsMissing = ' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.fieldsMissing')) . ';
			TBE_EDITOR.labels.refresh_login = '******'LANG']->JScharCode($this->getLL('m_refresh_login')) . ';
			TBE_EDITOR.labels.onChangeAlert = ' . $GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')) . ';
			evalFunc.USmode = ' . ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? '1' : '0') . ';
			TBE_EDITOR.backend_interface = "' . $GLOBALS['BE_USER']->uc['interfaceSetup'] . '";
			';
        }
        // add JS required for inline fields
        if (count($this->inline->inlineData)) {
            $out .= '
			inline.addToDataArray(' . json_encode($this->inline->inlineData) . ');
			';
        }
        // Registered nested elements for tabs or inline levels:
        if (count($this->requiredNested)) {
            $out .= '
			TBE_EDITOR.addNested(' . json_encode($this->requiredNested) . ');
			';
        }
        // elements which are required or have a range definition:
        if (count($elements)) {
            $out .= '
			TBE_EDITOR.addElements(' . json_encode($elements) . ');
			TBE_EDITOR.initRequired();
			';
        }
        // $this->additionalJS_submit:
        if ($this->additionalJS_submit) {
            $additionalJS_submit = implode('', $this->additionalJS_submit);
            $additionalJS_submit = str_replace(CR, '', $additionalJS_submit);
            $additionalJS_submit = str_replace(LF, '', $additionalJS_submit);
            $out .= '
			TBE_EDITOR.addActionChecks("submit", "' . addslashes($additionalJS_submit) . '");
			';
        }
        $out .= LF . implode(LF, $this->additionalJS_post) . LF . $this->extJSCODE;
        $out .= '
			TBE_EDITOR.loginRefreshed();
		';
        // Regular direct output:
        if (!$update) {
            $spacer = LF . TAB;
            $out = $spacer . implode($spacer, $jsFile) . t3lib_div::wrapJS($out);
        }
        return $out;
    }
示例#16
0
    /**
     * Loads data in the HTML head section (e.g. JavaScript or stylesheet information).
     *
     * @return	void
     */
    protected function loadHeaderData()
    {
        // Load CSS Stylesheets:
        $this->loadStylesheet($this->relativePath . 'res/css/customExtJs.css');
        // Load Ext JS:
        $this->doc->getPageRenderer()->loadExtJS();
        // Integrate dynamic JavaScript such as configuration or lables:
        $this->doc->JScode .= t3lib_div::wrapJS('
			Ext.namespace("Recycler");
			Recycler.statics = ' . json_encode($this->getJavaScriptConfiguration()) . ';
			Recycler.lang = ' . json_encode($this->getJavaScriptLabels()) . ';');
        // Load Recycler JavaScript:
        $this->loadJavaScript($this->relativePath . 'res/js/ext_expander.js');
        $this->loadJavaScript($this->relativePath . 'res/js/search_field.js');
        $this->loadJavaScript($this->relativePath . 'res/js/t3_recycler.js');
    }
 /**
  * Retrieves JavaScript code (header part) for editor
  *
  * @param 	template	$doc
  * @return	string		JavaScript code
  */
 public function getJavascriptCode($doc)
 {
     $content = '';
     if ($this->isEnabled()) {
         $path_t3e = t3lib_extmgm::extRelPath('t3editor');
         // include needed javascript-frameworks
         /** @var $pageRenderer t3lib_PageRenderer */
         $pageRenderer = $doc->getPageRenderer();
         $pageRenderer->loadPrototype();
         $pageRenderer->loadScriptaculous();
         // include editor-css
         $content .= '<link href="' . t3lib_div::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . t3lib_extmgm::extRelPath('t3editor') . 'res/css/t3editor.css') . '" type="text/css" rel="stylesheet" />';
         // include editor-js-lib
         $doc->loadJavascriptLib($path_t3e . 'res/jslib/codemirror/codemirror.js');
         $doc->loadJavascriptLib($path_t3e . 'res/jslib/t3editor.js');
         if ($this->mode == self::MODE_TYPOSCRIPT) {
             $doc->loadJavascriptLib($path_t3e . 'res/jslib/ts_codecompletion/tsref.js');
             $doc->loadJavascriptLib($path_t3e . 'res/jslib/ts_codecompletion/completionresult.js');
             $doc->loadJavascriptLib($path_t3e . 'res/jslib/ts_codecompletion/tsparser.js');
             $doc->loadJavascriptLib($path_t3e . 'res/jslib/ts_codecompletion/tscodecompletion.js');
         }
         $content .= t3lib_div::wrapJS('T3editor = T3editor || {};' . 'T3editor.lang = ' . json_encode($this->getJavaScriptLabels()) . ';' . LF . 'T3editor.PATH_t3e = "' . $GLOBALS['BACK_PATH'] . t3lib_extmgm::extRelPath('t3editor') . '"; ' . LF . 'T3editor.URL_typo3 = "' . htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir) . '"; ' . LF . 'T3editor.template = ' . $this->getPreparedTemplate() . ';' . LF . 'T3editor.parserfile = ' . $this->getParserfileByMode($this->mode) . ';' . LF . 'T3editor.stylesheet = ' . $this->getStylesheetByMode($this->mode) . ';');
     }
     return $content;
 }
    /**
     * Return the HTML code for loading the Javascript files
     *
     * @param	integer		$RTEcounter: The index number of the current RTE editing area within the form.
     *
     * @return	string		the html code for loading the Javascript Files
     */
    protected function loadJSfiles($RTEcounter)
    {
        $loadJavascriptCode = '<script type="text/javascript" src="' . $this->doConcatenate($RTEcounter) . '"></script>' . LF;
        $loadJavascriptCode .= t3lib_div::wrapJS('
			if (typeof(RTEarea) == "undefined") {
				RTEarea = new Object();
				RTEarea[0] = new Object();
				RTEarea[0].version = "' . $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['version'] . '";
				RTEarea[0].editorUrl = "' . $this->extHttpPath . 'htmlarea/";
				RTEarea[0].editorCSS = "' . t3lib_div::createVersionNumberedFilename($this->editorCSS) . '";
				RTEarea[0].editorSkin = "' . dirname($this->editorCSS) . '/";
				RTEarea[0].editedContentCSS = "' . t3lib_div::createVersionNumberedFilename($this->editedContentCSS) . '";
				RTEarea[0].hostUrl = "' . $this->hostURL . '";
				RTEarea[0].enableDebugMode = ' . ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['enableDebugMode'] ? 'true' : 'false') . ';
				RTEarea.init = function() {
					if (typeof(HTMLArea) == "undefined" || !Ext.isReady) {
						window.setTimeout("RTEarea.init();", 40);
					} else {
						Ext.QuickTips.init();
						HTMLArea.init();
					}
				};
				RTEarea.initEditor = function(editorNumber) {
					if (typeof(HTMLArea) == "undefined") {
						RTEarea.initEditor.defer(40, null, [editorNumber]);
					} else {
						HTMLArea.initEditor(editorNumber);
					}
				};
			}');
        return $loadJavascriptCode;
    }