示例#1
0
    /**
     * Main function of the module. Write the content to $this->content
     * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
     *
     * @return	[type]		...
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        $PATH_TYPO3 = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/';
        if ($BE_USER->user["admin"]) {
            // Draw the header.
            $this->doc = t3lib_div::makeInstance("template");
            $this->doc->backPath = $BACK_PATH;
            $this->pageRenderer = $this->doc->getPageRenderer();
            // Include Ext JS
            $this->pageRenderer->loadExtJS(true, true);
            $this->pageRenderer->enableExtJSQuickTips();
            $this->pageRenderer->enableExtJsDebug();
            $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/js/tx.caretaker.js', 'text/javascript', FALSE, FALSE);
            $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeTree.js', 'text/javascript', FALSE, FALSE);
            //Add caretaker css
            $this->pageRenderer->addCssFile('../res/css/tx.caretaker.nodetree.css', 'stylesheet', 'all', '', FALSE);
            // storage Pid
            $confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']);
            $storagePid = (int) $confArray['storagePid'];
            $this->pageRenderer->addJsInlineCode('Caretaker_Nodetree', '
			Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
			Ext.ns("tx.caretaker");
			Ext.onReady(function() {
				tx.caretaker.view = new Ext.Viewport({
					layout: "fit",
					items: {
						id: "cartaker-tree",
						xtype: "caretaker-nodetree",
                        autoScroll: true,
						dataUrl: "' . $this->doc->backPath . 'ajax.php?ajaxID=tx_caretaker::treeloader",
						addUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new",
						editUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[tx_caretaker_###NODE_TYPE###][###NODE_UID###]=edit",
						hideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=1",
						unhideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=0"
					}
				});

				tx_caretaker_updateTreeById = function( id ){
					tx_caretaker_tree = Ext.getCmp("cartaker-tree");
					tx_caretaker_tree.reloadTreePartial( id );
				}
			});
			');
            $this->content .= $this->doc->startPage($LANG->getLL("title"));
            $this->doc->form = '';
        } else {
            // If no access or if not admin
            $this->doc = t3lib_div::makeInstance("mediumDoc");
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL("title"));
            $this->content .= $this->doc->header($LANG->getLL("title"));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
示例#2
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>';
         }
     }
 }
示例#3
0
    /**
     * Returns page start
     * This includes the proper header with charset, title, meta tag and beginning body-tag.
     *
     * @param	string		HTML Page title for the header
     * @return	string		Returns the whole header section of a HTML-document based on settings in internal variables (like styles, javascript code, charset, generator and docType)
     * @see endPage()
     */
    function startPage($title)
    {
        // hook	pre start page
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'])) {
            $preStartPageHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'];
            if (is_array($preStartPageHook)) {
                $hookParameters = array('title' => &$title);
                foreach ($preStartPageHook as $hookFunction) {
                    t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        $this->pageRenderer->backPath = $this->backPath;
        // alternative template for Header and Footer
        if ($this->pageHeaderFooterTemplateFile) {
            $file = t3lib_div::getFileAbsFileName($this->pageHeaderFooterTemplateFile, TRUE);
            if ($file) {
                $this->pageRenderer->setTemplateFile($file);
            }
        }
        // For debugging: If this outputs "QuirksMode"/"BackCompat" (IE) the browser runs in quirks-mode. Otherwise the value is "CSS1Compat"
        #		$this->JScodeArray[]='alert(document.compatMode);';
        // Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003
        $this->initCharset();
        header('Content-Type:text/html;charset=' . $this->charset);
        // Standard HTML tag
        $htmlTag = '<html xmlns="http://www.w3.org/1999/xhtml">';
        switch ($this->docType) {
            case 'html_3':
                $headerStart = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
                $htmlTag = '<html>';
                // disable rendering of XHTML tags
                $this->getPageRenderer()->setRenderXhtml(FALSE);
                break;
            case 'xhtml_strict':
                $headerStart = '<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
                break;
            case 'xhtml_frames':
                $headerStart = '<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
                break;
            case 'html_5':
                $headerStart = '<!DOCTYPE html>' . LF;
                $htmlTag = '<html>';
                // disable rendering of XHTML tags
                $this->getPageRenderer()->setRenderXhtml(FALSE);
                break;
                // The fallthrough is intended as XHTML 1.0 transitional is the default for the BE.
            // The fallthrough is intended as XHTML 1.0 transitional is the default for the BE.
            case 'xhtml_trans':
            default:
                $headerStart = '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
        }
        $this->pageRenderer->setHtmlTag($htmlTag);
        // This loads the tabulator-in-textarea feature. It automatically modifies
        // every textarea which is found.
        if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) {
            $this->loadJavascriptLib('tab.js');
        }
        // Get the browser info
        $browserInfo = t3lib_utility_Client::getBrowserInfo(t3lib_div::getIndpEnv('HTTP_USER_AGENT'));
        // Set the XML prologue
        $xmlPrologue = '<?xml version="1.0" encoding="' . $this->charset . '"?>';
        // Set the XML stylesheet
        $xmlStylesheet = '<?xml-stylesheet href="#internalStyle" type="text/css"?>';
        // Add the XML prologue for XHTML doctypes
        if ($this->docType !== 'html_3' && $this->docType !== 'html_5') {
            // Put the XML prologue before or after the doctype declaration according to browser
            if ($browserInfo['browser'] === 'msie' && $browserInfo['version'] < 7) {
                $headerStart = $headerStart . LF . $xmlPrologue;
            } else {
                $headerStart = $xmlPrologue . LF . $headerStart;
            }
            // Add the xml stylesheet according to doctype
            if ($this->docType !== 'xhtml_frames') {
                $headerStart = $headerStart . LF . $xmlStylesheet;
            }
        }
        $this->pageRenderer->setXmlPrologAndDocType($headerStart);
        $this->pageRenderer->setHeadTag('<head>' . LF . '<!-- TYPO3 Script ID: ' . htmlspecialchars($this->scriptID) . ' -->');
        $this->pageRenderer->setCharSet($this->charset);
        $this->pageRenderer->addMetaTag($this->generator());
        if ($this->useCompatibilityTag) {
            $this->pageRenderer->addMetaTag($this->xUaCompatible());
        }
        $this->pageRenderer->setTitle($title);
        // add docstyles
        $this->docStyle();
        // add jsCode - has to go to headerData as it may contain the script tags already
        $this->pageRenderer->addHeaderData($this->JScode);
        foreach ($this->JScodeArray as $name => $code) {
            $this->pageRenderer->addJsInlineCode($name, $code);
        }
        if (count($this->JScodeLibArray)) {
            foreach ($this->JScodeLibArray as $library) {
                $this->pageRenderer->addHeaderData($library);
            }
        }
        if ($this->extJScode) {
            $this->pageRenderer->addExtOnReadyCode($this->extJScode);
        }
        // hook for additional headerData
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'])) {
            $preHeaderRenderHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'];
            if (is_array($preHeaderRenderHook)) {
                $hookParameters = array('pageRenderer' => &$this->pageRenderer);
                foreach ($preHeaderRenderHook as $hookFunction) {
                    t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        // Construct page header.
        $str = $this->pageRenderer->render(t3lib_PageRenderer::PART_HEADER);
        $this->JScodeLibArray = array();
        $this->JScode = $this->extJScode = '';
        $this->JScodeArray = array();
        $this->endOfPageJsBlock = $this->pageRenderer->render(t3lib_PageRenderer::PART_FOOTER);
        if ($this->docType == 'xhtml_frames') {
            return $str;
        } else {
            $str .= $this->docBodyTagBegin() . ($this->divClass ? '

<!-- Wrapping DIV-section for whole page BEGIN -->
<div class="' . $this->divClass . '">
' : '') . trim($this->form);
        }
        return $str;
    }
示例#4
0
    /**
     * Main function of the module. Write the content to $this->content
     * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
     *
     * @return void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        $PATH_TYPO3 = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/';
        if ($BE_USER->user["admin"]) {
            // find node
            $node_repository = tx_caretaker_NodeRepository::getInstance();
            $node = $node_repository->id2node($this->node_id, true);
            if (!$node) {
                $node = $node_repository->getRootNode();
            }
            // Draw the header.
            $this->doc = t3lib_div::makeInstance("template");
            $this->doc->backPath = $BACK_PATH;
            $this->pageRenderer = $this->doc->getPageRenderer();
            // Include Ext JS
            $this->pageRenderer->loadExtJS();
            $this->pageRenderer->enableExtJSQuickTips();
            $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/js/tx.caretaker.js');
            $panels = array();
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['caretaker']['extJsBackendPanels'] as $extJsBackendPanel) {
                // register JS
                foreach ($extJsBackendPanel['jsIncludes'] as $jsInclude) {
                    $filename = $BACK_PATH . '../' . str_replace(PATH_site, '', t3lib_div::getFileAbsFileName($jsInclude));
                    $this->pageRenderer->addJsFile($filename);
                }
                // register CSS
                foreach ($extJsBackendPanel['cssIncludes'] as $cssInclude) {
                    $filename = $BACK_PATH . '../' . str_replace(PATH_site, '', t3lib_div::getFileAbsFileName($cssInclude));
                    $this->pageRenderer->addCssFile($filename);
                }
                // add ExtJs Panel
                $panels[$extJsBackendPanel['id']] = $extJsBackendPanel['xtype'];
            }
            $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeToolbar.js');
            // Enable debug mode for Ext JS
            $this->pageRenderer->enableExtJsDebug();
            // storage Pid
            $confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']);
            $storagePid = (int) $confArray['storagePid'];
            //Add caretaker css
            $this->pageRenderer->addCssFile($BACK_PATH . t3lib_extMgm::extRelPath('caretaker') . 'res/css/tx.caretaker.overview.css');
            $pluginItems = array();
            foreach ($panels as $id => $xtype) {
                $pluginItems[] = '{ id: "' . $id . '", xtype: "' . $xtype . '" , back_path: back_path , node_id: node_id }';
            }
            $this->pageRenderer->addJsInlineCode('Caretaker_Overview', '
				Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
				Ext.namespace("tx","tx.caretaker");

				Ext.QuickTips.init();

				Ext.onReady( function() {

					var back_path   = "' . $this->doc->backPath . '";
					var back_url    = "' . urlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')) . '";
					var path_typo3  = "' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/";
					var	add_url     = "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new";
					var node_id     = "' . $node->getCaretakerNodeId() . '";
					var node_type   = "' . strtolower($node->getType()) . '";
					var node_hidden = "' . $node->getHidden() . '";
					var node_uid    = "' . $node->getUid() . '";
					var node_title  = "' . htmlspecialchars($node->getTitle() ? $node->getTitle() : '[no title]') . '( ' . ($node->getTypeDescription() ? htmlspecialchars($node->getTypeDescription()) : $node->getType()) . ' )" ;
					var node_state  = "' . $node->getTestResult()->getState() . '" ;
					var node_state_info  = "' . $node->getTestResult()->getStateInfo() . '" ;

					tx.caretaker.view = new Ext.Viewport({
						layout: "fit",
						items: {
								xtype    : "panel",
								id       : "node",
								autoScroll: true,
								title    : node_title,
								iconCls  : "icon-caretaker-type-" + node_type,
								tbar     : {
									xtype: "caretaker-nodetoolbar",
									back_path: back_path,
									path_typo3: path_typo3,
									back_url: back_url,
									add_url :add_url,
									node_id: node_id,
									node_type: node_type,
									node_uid: node_uid,
									node_hidden: node_hidden,
									node_state: node_state,
									node_state_info: node_state_info
								},
								items    : [
									{
										xtype    : "panel",
										padding  : "10",
										layout   : "fit",
										id       : "caretaker-panels",
										items    : [
											' . implode(chr(10) . ',', $pluginItems) . chr(10) . '
										]
									}
								],

						}
					 });

				});
			');
            $this->content .= $this->doc->startPage($LANG->getLL("title"));
            $this->doc->form = '';
        } else {
            // If no access or if not admin
            $this->doc = t3lib_div::makeInstance("mediumDoc");
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL("title"));
            $this->content .= $this->doc->header($LANG->getLL("title"));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
示例#5
0
    /**
     * main function generating the BE scaffolding
     *
     * @return	void
     */
    public function render()
    {
        $this->executeHook('renderPreProcess');
        // prepare the scaffolding, at this point extension may still add javascript and css
        $logo = t3lib_div::makeInstance('TYPO3Logo');
        $logo->setLogo('gfx/typo3logo_mini.png');
        // create backend scaffolding
        $backendScaffolding = '
		<div id="typo3-top-container" class="x-hide-display">
			<div id="typo3-logo">' . $logo->render() . '</div>
			<div id="typo3-top" class="typo3-top-toolbar">' . $this->renderToolbar() . '</div>
		</div>

';
        /******************************************************
         * now put the complete backend document together
         ******************************************************/
        foreach ($this->cssFiles as $cssFileName => $cssFile) {
            $this->pageRenderer->addCssFile($cssFile);
            // load addditional css files to overwrite existing core styles
            if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
                $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
            }
        }
        if (!empty($this->css)) {
            $this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
        }
        foreach ($this->jsFiles as $jsFile) {
            $this->pageRenderer->addJsFile($jsFile);
        }
        $this->generateJavascript();
        $this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js);
        $this->loadResourcesForRegisteredNavigationComponents();
        // add state provider
        $GLOBALS['TBE_TEMPLATE']->setExtDirectStateProvider();
        $states = $GLOBALS['BE_USER']->uc['BackendComponents']['States'];
        //save states in BE_USER->uc
        $extOnReadyCode = '
			Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
				key: "BackendComponents.States",
				autoRead: false
			}));
		';
        if ($states) {
            $extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');';
        }
        $extOnReadyCode .= '
			TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
			if (typeof console === "undefined") {
				console = TYPO3.Backend.DebugConsole;
			}
			TYPO3.ContextHelpWindow.init();';
        $this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
        // set document title:
        $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 ' . TYPO3_version . ']' : 'TYPO3 ' . TYPO3_version;
        $this->content = $backendScaffolding;
        // Renders the module page
        $this->content = $GLOBALS['TBE_TEMPLATE']->render($title, $this->content);
        $hookConfiguration = array('content' => &$this->content);
        $this->executeHook('renderPostProcess', $hookConfiguration);
        echo $this->content;
    }
 /**
  * Add JS inline code
  *
  * @param string $name
  * @param string $block
  * @param boolean $compress
  * @param boolean $forceOnTop
  */
 public function addJSInlineCode($name, $block, $compress = true, $forceOnTop = false)
 {
     $this->pageRenderer->addJsInlineCode($name, $block, $compress, $forceOnTop);
 }
示例#7
0
    /**
     * main function generating the BE scaffolding
     *
     * @return	void
     */
    public function render()
    {
        $this->executeHook('renderPreProcess');
        if (t3lib_div::makeInstance('DonateWindow')->isDonateWindowAllowed()) {
            $this->pageRenderer->addJsFile('js/donate.js');
        }
        // prepare the scaffolding, at this point extension may still add javascript and css
        $logo = t3lib_div::makeInstance('TYPO3Logo');
        $logo->setLogo('gfx/typo3logo_mini.png');
        $menu = $this->moduleMenu->render();
        if ($this->menuWidth != $this->menuWidthDefault) {
            $this->css .= '
				#typo3-top {
					margin-left: ' . $this->menuWidth . 'px;
				}
			';
        }
        // create backend scaffolding
        $backendScaffolding = '
	<div id="typo3-backend">
		<div id="typo3-top-container" class="x-hide-display">
			<div id="typo3-logo">' . $logo->render() . '</div>
			<div id="typo3-top" class="typo3-top-toolbar">' . $this->renderToolbar() . '</div>
		</div>
		<div id="typo3-main-container">
			<div id="typo3-side-menu" class="x-hide-display">' . $menu . '</div>
			<div id="typo3-content" class="x-hide-display">
				<iframe src="alt_intro.php" name="content" id="content" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto"></iframe>
			</div>
		</div>
	</div>
';
        /******************************************************
         * now put the complete backend document together
         ******************************************************/
        foreach ($this->cssFiles as $cssFileName => $cssFile) {
            $this->pageRenderer->addCssFile($cssFile);
            // load addditional css files to overwrite existing core styles
            if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
                $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
            }
        }
        if (!empty($this->css)) {
            $this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
        }
        foreach ($this->jsFiles as $jsFile) {
            $this->pageRenderer->addJsFile($jsFile);
        }
        // Those lines can be removed once we have at least one official ExtDirect router within the backend.
        $hasExtDirectRouter = FALSE;
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'] as $key => $value) {
                if (strpos($key, 'TYPO3.Ajax.ExtDirect') !== FALSE) {
                    $hasExtDirectRouter = TRUE;
                    break;
                }
            }
        }
        if ($hasExtDirectRouter) {
            $this->pageRenderer->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Ajax.ExtDirect', NULL, FALSE);
        }
        $this->generateJavascript();
        $this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js);
        // set document title:
        $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 ' . TYPO3_version . ']' : 'TYPO3 ' . TYPO3_version;
        // start page header:
        $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($title);
        $this->content .= $backendScaffolding;
        $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
        $hookConfiguration = array('content' => &$this->content);
        $this->executeHook('renderPostProcess', $hookConfiguration);
        echo $this->content;
    }