本文整理汇总了PHP中t3lib_div::wrapJS方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::wrapJS方法的具体用法?PHP t3lib_div::wrapJS怎么用?PHP t3lib_div::wrapJS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::wrapJS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* 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;
}
示例2: hideRTE
/**
* 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();})");
}
}
示例3: render
/**
* @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);
}
}
示例4: render
/**
* 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;
}
示例5: addJsInlineCode
/**
* 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);
}
}
}
示例6: loadExtJS
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: main
//.........这里部分代码省略.........
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;
}
示例8: addResources
/**
* 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
//.........这里部分代码省略.........
示例9: ext_getForm
/**
* 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;
}
示例10: ext_getForm
/**
* [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;
}
示例11: getModeSpecificJavascriptCode
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;
}
示例12: render
/**
* 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: includeHeader
/**
* 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>';
}
}
}
示例14: debugInPopUpWindow
/**
* 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);
}
示例15: JSbottom
//.........这里部分代码省略.........
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 = ' . $GLOBALS['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;
}