X-Git-Url: https://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/42fcefcf61703d09e6029af765a2cc592b489015..3ddfa364d3885b5d88b3774fa68554fce17ca9ed:/typo3/template.php diff --git a/typo3/template.php b/typo3/template.php index b0960d3..0bae8ff 100644 --- a/typo3/template.php +++ b/typo3/template.php @@ -1,2278 +1,74 @@ - */ -/** - * [CLASS/FUNCTION INDEX of SCRIPT] - * - * 145: function fw($str) - * + * Copyright notice * - * 169: class template - * 224: function template() + * (c) 1999-2011 Kasper SkÃ¥rhøj (kasperYYYY@typo3.com) + * All rights reserved * - * SECTION: EVALUATION FUNCTIONS - * 298: function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE) - * 315: function viewPageIcon($id,$backPath,$addParams='hspace="3"') - * 341: function issueCommand($params,$rUrl='') - * 356: function isCMlayers() - * 366: function thisBlur() - * 376: function helpStyle() - * 393: function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('','')) - * 419: function getFileheader($title,$path,$iconfile) - * 434: function makeShortcutIcon($gvList,$setList,$modName,$motherModName="") - * 467: function makeShortcutUrl($gvList,$setList) - * 488: function formWidth($size=48,$textarea=0,$styleOverride='') - * 513: function formWidthText($size=48,$styleOverride='',$wrap='') - * 530: function redirectUrls($thisLocation='') - * 554: function formatTime($tstamp,$type) - * 571: function parseTime() + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * SECTION: PAGE BUILDING FUNCTIONS. - * 604: function startPage($title) - * 686: function endPage() - * 720: function header($text) - * 741: function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE) - * 765: function divider($dist) - * 781: function spacer($dist) - * 800: function sectionHeader($label,$sH=FALSE,$addAttrib='') - * 817: function sectionBegin() - * 838: function sectionEnd() - * 858: function middle() - * 867: function endPageJS() - * 884: function docBodyTagBegin() - * 894: function docStyle() - * 936: function insertStylesAndJS($content) - * 956: function initCharset() - * 968: function generator() + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. * - * SECTION: OTHER ELEMENTS - * 1001: function icons($type, $styleAttribValue='') - * 1030: function t3Button($onClick,$label) - * 1041: function dfw($string) - * 1051: function rfw($string) - * 1061: function wrapInCData($string) - * 1078: function wrapScriptTags($string, $linebreak=TRUE) - * 1117: function table($arr, $layout='') - * 1159: function menuTable($arr1,$arr2=array(), $arr3=array()) - * 1192: function funcMenu($content,$menu) - * 1210: function clearCacheMenu($id,$addSaveOptions=0) - * 1246: function getContextMenuCode() - * 1251: function showClickmenu(table, uid, listFr, enDisItems, backPath, addParams) - * 1280: function showClickmenu_noajax(url) - * 1287: function showClickmenu_ajax(t3ajax) - * 1472: function getDragDropCode($table) - * 1483: function cancelDragEvent(event) - * 1496: function mouseMoveEvent (event) - * 1509: function dragElement(id,elementID) - * 1528: function dropElement(id) - * 1577: function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') - * 1607: function getTabMenuRaw($menuItems) - * 1676: function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1) - * 1801: function getDynTabMenuJScode() - * 1892: function getVersionSelector($id,$noAction=FALSE) * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * 2060: class bigDoc extends template - * - * - * 2069: class noDoc extends template - * - * - * 2078: class smallDoc extends template - * - * - * 2087: class mediumDoc extends template - * - * TOTAL FUNCTIONS: 57 - * (This index is automatically created/updated by the extension "extdeveval") - * - */ - - - -if (!defined('TYPO3_MODE')) die("Can't include this file directly."); - - + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ /** - * TYPO3 Backend Template Class - * - * This class contains functions for starting and ending the HTML of backend modules - * It also contains methods for outputting sections of content. - * Further there are functions for making icons, links, setting form-field widths etc. - * Color scheme and stylesheet definitions are also available here. - * Finally this file includes the language class for TYPO3's backend. - * - * After this file $LANG and $TBE_TEMPLATE are global variables / instances of their respective classes. - * This file is typically included right after the init.php file, - * if language and layout is needed. + * Contains class with layout/output function for TYPO3 Backend Scripts * - * Please refer to Inside TYPO3 for a discussion of how to use this API. + * Revised for TYPO3 3.6 2/2003 by Kasper SkÃ¥rhøj + * XHTML-trans compliant * - * @author Kasper SkÃ¥rhøj - * @package TYPO3 - * @subpackage core + * @author Kasper SkÃ¥rhøj */ -class template { - - // Vars you typically might want to/should set from outside after making instance of this class: - var $backPath = ''; // 'backPath' pointing back to the PATH_typo3 - var $form=''; // This can be set to the HTML-code for a formtag. Useful when you need a form to span the whole page; Inserted exactly after the body-tag. - var $JScodeLibArray = array(); // Similar to $JScode (see below) but used as an associative array to prevent double inclusion of JS code. This is used to include certain external Javascript libraries before the inline JS code. ':''); - } - - /** - * Creates the bodyTag. - * You can add to the bodyTag by $this->bodyTagAdditions - * - * @return string HTML body tag - */ - function docBodyTagBegin() { - $bodyContent = 'body onclick="if (top.menuReset) top.menuReset();" '.trim($this->bodyTagAdditions.($this->bodyTagId ? ' id="'.$this->bodyTagId.'"' : '')); - return '<'.trim($bodyContent).'>'; - } - - /** - * Outputting document style - * - * @return string HTML style section/link tags - */ - function docStyle() { - - // Request background image: - if ($this->backGroundImage) { - $this->inDocStylesArray[]=' BODY { background-image: url('.$this->backPath.$this->backGroundImage.'); }'; - } - - // Add inDoc styles variables as well: - $this->inDocStylesArray[] = $this->inDocStyles; - $this->inDocStylesArray[] = $this->inDocStyles_TBEstyle; - - // Implode it all: - $inDocStyles = implode(LF, $this->inDocStylesArray); - - if ($this->styleSheetFile) { - $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile); - } - if ($this->styleSheetFile2) { - $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile2); - } - - $this->pageRenderer->addCssInlineBlock('inDocStyles', $inDocStyles . LF . '/*###POSTCSSMARKER###*/'); - if ($this->styleSheetFile_post) { - $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile_post); - } - - } - - /** - * Insert additional style sheet link - * - * @param string $key: some key identifying the style sheet - * @param string $href: uri to the style sheet file - * @param string $title: value for the title attribute of the link element - * @return string $relation: value for the rel attribute of the link element - * @return void - */ - function addStyleSheet($key, $href, $title='', $relation='stylesheet') { - if (strpos($href, '://') !== FALSE || substr($href, 0, 1) === '/') { - $file = $href; - } else { - $file = $this->backPath . $href; - } - $this->pageRenderer->addCssFile($file, $relation, 'screen', $title); - } - - /** - * Add all *.css files of the directory $path to the stylesheets - * - * @param string directory to add - * @return void - */ - function addStyleSheetDirectory($path) { - // calculation needed, when TYPO3 source is used via a symlink - // absolute path to the stylesheets - $filePath = dirname(t3lib_div::getIndpEnv('SCRIPT_FILENAME')) . '/' . $GLOBALS['BACK_PATH'] . $path; - // clean the path - $resolvedPath = t3lib_div::resolveBackPath($filePath); - // read all files in directory and sort them alphabetically - $files = t3lib_div::getFilesInDir($resolvedPath, 'css', FALSE, 1); - foreach ($files as $file) { - $this->pageRenderer->addCssFile($GLOBALS['BACK_PATH'] . $path . $file, 'stylesheet', 'all'); - } - } - - /** - * Insert post rendering document style into already rendered content - * This is needed for extobjbase - * - * @param string style-content to insert. - * @return string content with inserted styles - */ - function insertStylesAndJS($content) { - // insert accumulated CSS - $this->inDocStylesArray[] = $this->inDocStyles; - $styles = LF.implode(LF, $this->inDocStylesArray); - $content = str_replace('/*###POSTCSSMARKER###*/',$styles,$content); - - // insert accumulated JS - $jscode = $this->JScode.LF.$this->wrapScriptTags(implode(LF, $this->JScodeArray)); - $content = str_replace('',$jscode,$content); - - return $content; - } - - /** - * Returns an array of all stylesheet directories belonging to core and skins - * - * @return array Stylesheet directories - */ - public function getSkinStylesheetDirectories() { - $stylesheetDirectories = array(); - - // add default core stylesheets - foreach ($this->stylesheetsCore as $stylesheetDir) { - $stylesheetDirectories[] = $stylesheetDir; - } - - // Stylesheets from skins - // merge default css directories ($this->stylesheetsSkin) with additional ones and include them - if (is_array($GLOBALS['TBE_STYLES']['skins'])) { - // loop over all registered skins - foreach ($GLOBALS['TBE_STYLES']['skins'] as $skinExtKey => $skin) { - $skinStylesheetDirs = $this->stylesheetsSkins; - - // skins can add custom stylesheetDirectories using - // $TBE_STYLES['skins'][$_EXTKEY]['stylesheetDirectories'] - if (is_array($skin['stylesheetDirectories'])) { - $skinStylesheetDirs = array_merge($skinStylesheetDirs, $skin['stylesheetDirectories']); - } - - // add all registered directories - foreach ($skinStylesheetDirs as $stylesheetDir) { - // for EXT:myskin/stylesheets/ syntax - if (substr($stylesheetDir, 0, 4) === 'EXT:') { - list($extKey, $path) = explode('/', substr($stylesheetDir, 4), 2); - if (strcmp($extKey, '') && t3lib_extMgm::isLoaded($extKey) && strcmp($path, '')) { - $stylesheetDirectories[] = t3lib_extMgm::extRelPath($extKey) . $path; - } - } else { - // for relative paths - $stylesheetDirectories[] = t3lib_extMgm::extRelPath($skinExtKey) . $stylesheetDir; - } - } - } - } - return $stylesheetDirectories; - } - - /** - * Initialize the charset. - * Sets the internal $this->charset variable to the charset defined in $GLOBALS["LANG"] (or the default as set in this class) - * Returns the meta-tag for the document header - * - * @return string tag with charset from $this->charset or $GLOBALS['LANG']->charSet - */ - function initCharset() { - // Set charset to the charset provided by the current backend users language selection: - $this->charset = $GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : $this->charset; - // Return meta tag: - return ''; - } - - /** - * Returns generator meta tag - * - * @return string tag with name "generator" - */ - function generator() { - $str = 'TYPO3 '.TYPO3_branch.', ' . TYPO3_URL_GENERAL . ', © Kasper Skårhøj 1998-2009, extensions are copyright of their respective owners.'; - return ''; - } - - /** - * Returns X-UA-Compatible meta tag - * - * @param string $content Content of the compatible tag (default: IE-8) - * @return string - */ - public function xUaCompatible($content = 'IE=8') { - return ''; - } - - - - - - - - /***************************************** - * - * OTHER ELEMENTS - * Tables, buttons, formatting dimmed/red strings - * - ******************************************/ - - - /** - * Returns an image-tag with an 18x16 icon of the following types: - * - * $type: - * -1: OK icon (Check-mark) - * 1: Notice (Speach-bubble) - * 2: Warning (Yellow triangle) - * 3: Fatal error (Red stop sign) - * - * @param integer See description - * @param string Value for style attribute - * @return string HTML image tag (if applicable) - */ - function icons($type, $styleAttribValue='') { - switch($type) { - case '3': - $icon = 'status-dialog-error'; - break; - case '2': - $icon = 'status-dialog-warning'; - break; - case '1': - $icon = 'status-dialog-notification'; - break; - case '-1': - $icon = 'status-dialog-ok'; - break; - default: - break; - } - if ($icon) { - return t3lib_iconWorks::getSpriteIcon($icon); - } - } - - /** - * Returns an button with the $onClick action and $label - * - * @param string The value of the onclick attribute of the input tag (submit type) - * @param string The label for the button (which will be htmlspecialchar'ed) - * @return string A tag of the type "submit" - */ - function t3Button($onClick,$label) { - $button = ''; - return $button; - } - - /** - * dimmed-fontwrap. Returns the string wrapped in a -tag defining the color to be gray/dimmed - * - * @param string Input string - * @return string Output string - */ - function dfw($string) { - return ''.$string.''; - } - - /** - * red-fontwrap. Returns the string wrapped in a -tag defining the color to be red - * - * @param string Input string - * @return string Output string - */ - function rfw($string) { - return ''.$string.''; - } - - /** - * Returns string wrapped in CDATA "tags" for XML / XHTML (wrap content of '.$cr; - } - return trim($string); - } - - // These vars defines the layout for the table produced by the table() function. - // You can override these values from outside if you like. - var $tableLayout = array( - 'defRow' => array( - 'defCol' => array('','') - ) - ); - var $table_TR = ''; - var $table_TABLE = ''; - - /** - * Returns a table based on the input $data - * - * @param array Multidim array with first levels = rows, second levels = cells - * @param array If set, then this provides an alternative layout array instead of $this->tableLayout - * @return string The HTML table. - * @internal - */ - function table($data, $layout = '') { - $result = ''; - if (is_array($data)) { - $tableLayout = (is_array($layout) ? $layout : $this->tableLayout); - - $rowCount = 0; - foreach ($data as $tableRow) { - if ($rowCount % 2) { - $layout = is_array($tableLayout['defRowOdd']) ? $tableLayout['defRowOdd'] : $tableLayout['defRow']; - } else { - $layout = is_array($tableLayout['defRowEven']) ? $tableLayout['defRowEven'] : $tableLayout['defRow']; - } - $rowLayout = is_array($tableLayout[$rowCount]) ? $tableLayout[$rowCount] : $layout; - $rowResult = ''; - if (is_array($tableRow)) { - $cellCount = 0; - foreach ($tableRow as $tableCell) { - $cellWrap = (is_array($layout[$cellCount]) ? $layout[$cellCount] : $layout['defCol']); - $cellWrap = (is_array($rowLayout['defCol']) ? $rowLayout['defCol'] : $cellWrap); - $cellWrap = (is_array($rowLayout[$cellCount]) ? $rowLayout[$cellCount] : $cellWrap); - $rowResult .= $cellWrap[0] . $tableCell . $cellWrap[1]; - $cellCount++; - } - } - $rowWrap = (is_array($layout['tr']) ? $layout['tr'] : array($this->table_TR, '')); - $rowWrap = (is_array($rowLayout['tr']) ? $rowLayout['tr'] : $rowWrap); - $result .= $rowWrap[0] . $rowResult . $rowWrap[1]; - $rowCount++; - } - $tableWrap = is_array($tableLayout['table']) ? $tableLayout['table'] : array($this->table_TABLE, '
'); - $result = $tableWrap[0] . $result . $tableWrap[1]; - } - return $result; - } - - /** - * Constructs a table with content from the $arr1, $arr2 and $arr3. - * Used in eg. ext/belog/mod/index.php - refer to that for examples - * - * @param array Menu elements on first level - * @param array Secondary items - * @param array Third-level items - * @return string HTML content, ...
- */ - function menuTable($arr1,$arr2=array(), $arr3=array()) { - $rows = max(array(count($arr1),count($arr2),count($arr3))); - - $menu=' - '; - for($a=0;$a<$rows;$a++) { - $menu.=''; - $cls=array(); - $valign='middle'; - $cls[]=''; - if (count($arr2)) { - $cls[]=''; - if (count($arr3)) { - $cls[]=''; - } - } - $menu.=implode($cls,''); - $menu.=''; - } - $menu.=' -
'.$arr1[$a][0].''.$arr1[$a][1].''.$arr2[$a][0].''.$arr2[$a][1].''.$arr3[$a][0].''.$arr3[$a][1].'  
- '; - return $menu; - } - - /** - * Returns a one-row/two-celled table with $content and $menu side by side. - * The table is a 100% width table and each cell is aligned left / right - * - * @param string Content cell content (left) - * @param string Menu cell content (right) - * @return string HTML output - */ - function funcMenu($content,$menu) { - return ' - - - - - -
'.$content.''.$menu.'
'; - } - - /** - * Creates a selector box with clear-cache items. - * Rather specialized functions - at least don't use it with $addSaveOptions unless you know what you do... - * - * @param integer The page uid of the "current page" - the one that will be cleared as "clear cache for this page". - * @param boolean If $addSaveOptions is set, then also the array of save-options for TCE_FORMS will appear. - * @return string '.implode('',$opt).''; - - if (count($opt)>1) { - return $af_content; - } - } - - - /** - * Includes a javascript library that exists in the core /typo3/ directory. The - * backpath is automatically applied - * - * @param string $lib: Library name. Call it with the full path - * like "contrib/prototype/prototype.js" to load it - * @return void - */ - function loadJavascriptLib($lib) { - $this->pageRenderer->addJsFile($this->backPath . $lib); - } - - - - /** - * Includes the necessary Javascript function for the clickmenu (context sensitive menus) in the document - * - * @return array Deprecated: Includes the code already in the doc, so the return array is always empty. - * Please just call this function without expecting a return value for future calls - */ - function getContextMenuCode() { - $this->pageRenderer->loadPrototype(); - $this->loadJavascriptLib('js/clickmenu.js'); - - $this->JScodeArray['clickmenu'] = ' - Clickmenu.clickURL = "'.$this->backPath.'alt_clickmenu.php"; - Clickmenu.ajax = '.($this->isCMLayers() ? 'true' : 'false' ).';'; - - // return array deprecated since 4.2 - return array('','',''); - } - - /** - * Includes the necessary javascript file (tree.js) for use on pages which have the - * drag and drop functionality (usually pages and folder display trees) - * - * @param string indicator of which table the drag and drop function should work on (pages or folders) - * @return array If values are present: [0] = A - - '; - } - - } - return $content; - } - - /** - * Creates the id for dynTabMenus. - * - * @param string $identString: Identification string. This should be unique for every instance of a dynamic menu! - * @return string The id with a short MD5 of $identString and prefixed "DTM-", like "DTM-2e8791854a" - */ - function getDynTabMenuId($identString) { - $id = 'DTM-'.t3lib_div::shortMD5($identString); - return $id; - } - - /** - * Creates the version selector for the page id inputted. - * Requires the core version management extension, "version" to be loaded. - * - * @param integer Page id to create selector for. - * @param boolean If set, there will be no button for swapping page. - * @return void - */ - public function getVersionSelector($id, $noAction = FALSE) { - if (t3lib_extMgm::isLoaded('version')) { - $versionGuiObj = t3lib_div::makeInstance('tx_version_gui'); - return $versionGuiObj->getVersionSelector($id, $noAction); - } - } - - /** - * Function to load a HTML template file with markers. - * When calling from own extension, use syntax getHtmlTemplate('EXT:extkey/template.html') - * - * @param string tmpl name, usually in the typo3/template/ directory - * @return string HTML of template - */ - function getHtmlTemplate($filename) { - // setting the name of the original HTML template - $this->moduleTemplateFilename = $filename; - - if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) { - $filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]; - } - if (t3lib_div::isFirstPartOfStr($filename, 'EXT:')) { - $filename = t3lib_div::getFileAbsFileName($filename, TRUE, TRUE); - } else if (!t3lib_div::isAbsPath($filename)) { - $filename = t3lib_div::resolveBackPath($this->backPath . $filename); - } else if (!t3lib_div::isAllowedAbsPath($filename)) { - $filename = ''; - } - $htmlTemplate = ''; - if ($filename !== '') { - $htmlTemplate = t3lib_div::getURL($filename); - } - return $htmlTemplate; - } - - /** - * Define the template for the module - * - * @param string filename - */ - public function setModuleTemplate($filename) { - // Load Prototype lib for IE event - $this->pageRenderer->loadPrototype(); - $this->loadJavascriptLib('js/iecompatibility.js'); - $this->moduleTemplate = $this->getHtmlTemplate($filename); - } - - /** - * Put together the various elements for the module using a static HTML - * template - * - * @param array Record of the current page, used for page path and info - * @param array HTML for all buttons - * @param array HTML for all other markers - * @return string Composite HTML - */ - public function moduleBody($pageRecord = array(), $buttons = array(), $markerArray = array(), $subpartArray = array()) { - // Get the HTML template for the module - $moduleBody = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###FULLDOC###'); - // Add CSS - $this->inDocStylesArray[] = 'html { overflow: hidden; }'; - // Add JS code to the for IE - $this->JScode.= $this->wrapScriptTags(' - // workaround since IE6 cannot deal with relative height for scrolling elements - function resizeDocBody() { - $("typo3-docbody").style.height = (document.body.offsetHeight - parseInt($("typo3-docheader").getStyle("height"))); - } - if (Prototype.Browser.IE) { - var version = parseFloat(navigator.appVersion.split(\';\')[1].strip().split(\' \')[1]); - if (version == 6) { - Event.observe(window, "resize", resizeDocBody, false); - Event.observe(window, "load", resizeDocBody, false); - } - } - '); - - // Get the page path for the docheader - $markerArray['PAGEPATH'] = $this->getPagePath($pageRecord); - // Get the page info for the docheader - $markerArray['PAGEINFO'] = $this->getPageInfo($pageRecord); - // Get all the buttons for the docheader - $docHeaderButtons = $this->getDocHeaderButtons($buttons); - // Merge docheader buttons with the marker array - $markerArray = array_merge($markerArray, $docHeaderButtons); - // replacing subparts - foreach ($subpartArray as $marker => $content) { - $moduleBody = t3lib_parsehtml::substituteSubpart($moduleBody, $marker, $content); - } - - // adding flash messages - if ($this->showFlashMessages) { - $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages(); - if (!empty($flashMessages)) { - $markerArray['FLASHMESSAGES'] = '
' . $flashMessages . '
'; - - // if there is no dedicated marker for the messages present - // then force them to appear before the content - if (strpos($moduleBody, '###FLASHMESSAGES###') === FALSE) { - $moduleBody = str_replace( - '###CONTENT###', - '###FLASHMESSAGES######CONTENT###', - $moduleBody - ); - } - } - } - - // Hook for adding more markers/content to the page, like the version selector - if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'])) { - $params = array( - 'moduleTemplateFilename' => &$this->moduleTemplateFilename, - 'moduleTemplate' => &$this->moduleTemplate, - 'moduleBody' => &$moduleBody, - 'markers' => &$markerArray, - 'parentObject' => &$this - ); - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'] as $funcRef) { - t3lib_div::callUserFunction($funcRef, $params, $this); - } - } - - // replacing all markers with the finished markers and return the HTML content - return t3lib_parsehtml::substituteMarkerArray($moduleBody, $markerArray, '###|###'); - - } - - /** - * Fill the button lists with the defined HTML - * - * @param array HTML for all buttons - * @return array Containing HTML for both buttonlists - */ - protected function getDocHeaderButtons($buttons) { - $markers = array(); - // Fill buttons for left and right float - $floats = array('left', 'right'); - foreach($floats as $key) { - // Get the template for each float - $buttonTemplate = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###BUTTON_GROUPS_' . strtoupper($key) . '###'); - // Fill the button markers in this float - $buttonTemplate = t3lib_parsehtml::substituteMarkerArray($buttonTemplate, $buttons, '###|###', true); - // getting the wrap for each group - $buttonWrap = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###BUTTON_GROUP_WRAP###'); - // looping through the groups (max 6) and remove the empty groups - for ($groupNumber = 1; $groupNumber < 6; $groupNumber++) { - $buttonMarker = '###BUTTON_GROUP' . $groupNumber . '###'; - $buttonGroup = t3lib_parsehtml::getSubpart($buttonTemplate, $buttonMarker); - if (trim($buttonGroup)) { - if ($buttonWrap) { - $buttonGroup = t3lib_parsehtml::substituteMarker($buttonWrap, '###BUTTONS###', $buttonGroup); - } - $buttonTemplate = t3lib_parsehtml::substituteSubpart($buttonTemplate, $buttonMarker, trim($buttonGroup)); - } - } - // replace the marker with the template and remove all line breaks (for IE compat) - $markers['BUTTONLIST_' . strtoupper($key)] = str_replace(LF, '', $buttonTemplate); - } - - // Hook for manipulating docHeaderButtons - if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'])) { - $params = array( - 'buttons' => $buttons, - 'markers' => &$markers, - 'pObj' => &$this - ); - foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'] as $funcRef) { - t3lib_div::callUserFunction($funcRef, $params, $this); - } - } - - return $markers; - } - - /** - * Generate the page path for docheader - * - * @param array Current page - * @return string Page path - */ - protected function getPagePath($pageRecord) { - // Is this a real page - if ($pageRecord['uid']) { - $title = substr($pageRecord['_thePathFull'], 0, -1); - // remove current page title - $pos = strrpos($title, '/'); - if ($pos !== FALSE) { - $title = substr($title, 0, $pos) . '/'; - } - } else { - $title = ''; - } - - // Setting the path of the page - $pagePath = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.path', 1) . ': '; - - // crop the title to title limit (or 50, if not defined) - $cropLength = (empty($GLOBALS['BE_USER']->uc['titleLen'])) ? 50 : $GLOBALS['BE_USER']->uc['titleLen']; - $croppedTitle = t3lib_div::fixed_lgd_cs($title, -$cropLength); - if ($croppedTitle !== $title) { - $pagePath .= '' . htmlspecialchars($croppedTitle) . ''; - } else { - $pagePath .= htmlspecialchars($title); - } - $pagePath .= ''; - return $pagePath; - } - - /** - * Setting page icon with clickmenu + uid for docheader - * - * @param array Current page - * @return string Page info - */ - protected function getPageInfo($pageRecord) { - global $BE_USER; - // Add icon with clickmenu, etc: - if ($pageRecord['uid']) { // If there IS a real page - $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages'); - $iconImg = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord, array('title'=>$alttext)); - // Make Icon: - $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); - $uid = $pageRecord['uid']; - $title = t3lib_BEfunc::getRecordTitle('pages', $pageRecord); - } else { // On root-level of page tree - // Make Icon - $iconImg = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']))); - if($BE_USER->user['admin']) { - $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); - } else { - $theIcon = $iconImg; - } - $uid = '0'; - $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; - } - - // Setting icon with clickmenu + uid - $pageInfo = $theIcon . '' . htmlspecialchars($title) . ' [' . $uid . ']'; - return $pageInfo; - } - - /** - * Makes a collapseable section. See reports module for an example - * - * @param string $title - * @param string $html - * @param string $id - * @param string $saveStatePointer - * @return string - */ - public function collapseableSection($title, $html, $id, $saveStatePointer = '') { - $hasSave = $saveStatePointer ? TRUE : FALSE; - $collapsedStyle = $collapsedClass = ''; - - if ($hasSave) { - /** @var $settings extDirect_DataProvider_BackendUserSettings */ - $settings = t3lib_div::makeInstance('extDirect_DataProvider_BackendUserSettings'); - $value = $settings->get($saveStatePointer . '.' . $id); - if ($value) { - $collapsedStyle = ' style="display: none"'; - $collapsedClass = ' collapsed'; - } else { - $collapsedStyle = ''; - $collapsedClass = ' expanded'; - } - } - - $this->pageRenderer->loadExtJS(); - $this->pageRenderer->addExtOnReadyCode(' - Ext.select("h2.section-header").each(function(element){ - element.on("click", function(event, tag) { - var state = 0, - el = Ext.fly(tag), - div = el.next("div"), - saveKey = el.getAttribute("rel"); - if (el.hasClass("collapsed")) { - el.removeClass("collapsed").addClass("expanded"); - div.slideIn("t", { - easing: "easeIn", - duration: .5 - }); - } else { - el.removeClass("expanded").addClass("collapsed"); - div.slideOut("t", { - easing: "easeOut", - duration: .5, - remove: false, - useDisplay: true - }); - state = 1; - } - if (saveKey) { - try { - top.TYPO3.BackendUserSettings.ExtDirect.set(saveKey + "." + tag.id, state, function(response) {}); - } catch(e) {} - } - }); - }); - '); - return ' -

' . $title . '

- ' . $html . ' - '; - - } - - +if (!defined('TYPO3_MODE')) { + die('Can\'t include this file directly.'); } - - -// ****************************** -// Extension classes of the template class. -// These are meant to provide backend screens with different widths. -// They still do because of the different class-prefixes used for the
-sections -// but obviously the final width is determined by the stylesheet used. -// ****************************** - -/** - * Extension class for "template" - used for backend pages which are wide. Typically modules taking up all the space in the "content" frame of the backend - * The class were more significant in the past than today. - * +/* + * @deprecated since 6.0, the classname template and this file is obsolete + * and will be removed by 7.0. The class was renamed and is now located at: + * typo3/sysext/backend/Classes/Template/DocumentTemplate.php */ -class bigDoc extends template { - var $divClass = 'typo3-bigDoc'; -} - -/** - * Extension class for "template" - used for backend pages without the "document" background image - * The class were more significant in the past than today. - * +require_once t3lib_extMgm::extPath('backend') . 'Classes/Template/DocumentTemplate.php'; +/* + * @deprecated since 6.0, the classname bigDoc and this file is obsolete + * and will be removed by 7.0. The class was renamed and is now located at: + * typo3/sysext/backend/Classes/Template/BigDocumentTemplate.php */ -class noDoc extends template { - var $divClass = 'typo3-noDoc'; -} - -/** - * Extension class for "template" - used for backend pages which were narrow (like the Web>List modules list frame. Or the "Show details" pop up box) - * The class were more significant in the past than today. - * +require_once t3lib_extMgm::extPath('backend') . 'Classes/Template/BigDocumentTemplate.php'; +/* + * @deprecated since 6.0, the classname noDoc and this file is obsolete + * and will be removed by 7.0. The class was renamed and is now located at: + * typo3/sysext/backend/Classes/Template/StandardDocumentTemplate.php */ -class smallDoc extends template { - var $divClass = 'typo3-smallDoc'; -} - -/** - * Extension class for "template" - used for backend pages which were medium wide. Typically submodules to Web or File which were presented in the list-frame when the content frame were divided into a navigation and list frame. - * The class were more significant in the past than today. But probably you should use this one for most modules you make. - * +require_once t3lib_extMgm::extPath('backend') . 'Classes/Template/StandardDocumentTemplate.php'; +/* + * @deprecated since 6.0, the classname smallDoc and this file is obsolete + * and will be removed by 7.0. The class was renamed and is now located at: + * typo3/sysext/backend/Classes/Template/SmallDocumentTemplate.php */ -class mediumDoc extends template { - var $divClass = 'typo3-mediumDoc'; -} - - -/** - * Extension class for "template" - used in the context of frontend editing. +require_once t3lib_extMgm::extPath('backend') . 'Classes/Template/SmallDocumentTemplate.php'; +/* + * @deprecated since 6.0, the classname mediumDoc and this file is obsolete + * and will be removed by 7.0. The class was renamed and is now located at: + * typo3/sysext/backend/Classes/Template/MediumDocumentTemplate.php */ -class frontendDoc extends template { - - /** - * Gets instance of PageRenderer - * - * @return t3lib_PageRenderer - */ - public function getPageRenderer() { - if (!isset($this->pageRenderer)) { - $this->pageRenderer = $GLOBALS['TSFE']->getPageRenderer(); - } - return $this->pageRenderer; - } - - /** - * Used in the frontend context to insert header data via TSFE->additionalHeaderData. - * Mimics header inclusion from template->startPage(). - * - * @return void - */ - public function insertHeaderData() { - - $this->backPath = $GLOBALS['TSFE']->backPath = TYPO3_mainDir; - $this->pageRenderer->setBackPath($this->backPath); - $this->docStyle(); - - // add applied JS/CSS to $GLOBALS['TSFE'] - if ($this->JScode) { - $this->pageRenderer->addHeaderData($this->JScode); - } - if (count($this->JScodeArray)) { - foreach ($this->JScodeArray as $name => $code) { - $this->pageRenderer->addJsInlineCode($name, $code); - } - } - } -} - - -if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/template.php'])) { - include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/template.php']); -} - - - -// ****************************** -// The template is loaded -// ****************************** -$GLOBALS['TBE_TEMPLATE'] = t3lib_div::makeInstance('template'); - - -?> +require_once t3lib_extMgm::extPath('backend') . 'Classes/Template/MediumDocumentTemplate.php'; +/* + * @deprecated since 6.0, the classname frontendDoc and this file is obsolete + * and will be removed by 7.0. The class was renamed and is now located at: + * typo3/sysext/backend/Classes/Template/FrontendDocumentTemplate.php + */ +require_once t3lib_extMgm::extPath('backend') . 'Classes/Template/FrontendDocumentTemplate.php'; +?> \ No newline at end of file