*/ /** * [CLASS/FUNCTION INDEX of SCRIPT] * * 137: function fw($str) * * * 161: class template * 216: function template() * * SECTION: EVALUATION FUNCTIONS * 290: function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE) * 307: function viewPageIcon($id,$backPath,$addParams='hspace="3"') * 333: function issueCommand($params,$rUrl='') * 348: function isCMlayers() * 358: function thisBlur() * 368: function helpStyle() * 385: function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('','')) * 411: function getFileheader($title,$path,$iconfile) * 426: function makeShortcutIcon($gvList,$setList,$modName,$motherModName="") * 459: function makeShortcutUrl($gvList,$setList) * 480: function formWidth($size=48,$textarea=0,$styleOverride='') * 505: function formWidthText($size=48,$styleOverride='',$wrap='') * 522: function redirectUrls($thisLocation='') * 546: function formatTime($tstamp,$type) * 559: function parseTime() * * SECTION: PAGE BUILDING FUNCTIONS. * 592: function startPage($title) * 667: function endPage() * 696: function header($text) * 717: function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE) * 741: function divider($dist) * 757: function spacer($dist) * 776: function sectionHeader($label,$sH=FALSE,$addAttrib='') * 793: function sectionBegin() * 814: function sectionEnd() * 834: function middle() * 843: function endPageJS() * 860: function docBodyTagBegin() * 870: function docStyle() * 912: function insertStylesAndJS($content) * 932: function initCharset() * 944: function generator() * * SECTION: OTHER ELEMENTS * 977: function icons($type, $styleAttribValue='') * 1006: function t3Button($onClick,$label) * 1017: function dfw($string) * 1027: function rfw($string) * 1037: function wrapInCData($string) * 1054: function wrapScriptTags($string, $linebreak=TRUE) * 1092: function table($arr, $layout='') * 1134: function menuTable($arr1,$arr2=array(), $arr3=array()) * 1167: function funcMenu($content,$menu) * 1185: function clearCacheMenu($id,$addSaveOptions=0) * 1221: function getContextMenuCode() * 1408: function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') * 1438: function getTabMenuRaw($menuItems) * 1507: function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1) * 1630: function getDynTabMenuJScode() * 1687: function getVersionSelector($id,$noAction=FALSE) * * * 1761: class bigDoc extends template * * * 1770: class noDoc extends template * * * 1779: class smallDoc extends template * * * 1788: class mediumDoc extends template * * TOTAL FUNCTIONS: 49 * (This index is automatically created/updated by the extension "extdeveval") * */ if (!defined('TYPO3_MODE')) die("Can't include this file directly."); /** * Depreciated fontwrap function. Is just transparent now. * * @param string Input string * @return string Output string (in the old days this was wrapped in tags) * @depreciated */ function fw($str) { return $str; } /** * 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. * * Please refer to Inside TYPO3 for a discussion of how to use this API. * * @author Kasper Skaarhoj * @package TYPO3 * @subpackage core */ 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 $JScode=''; // Additional header code (eg. a JavaScript section) could be accommulated in this var. It will be directly outputted in the header. var $JScodeArray = array(); // Similar to $JScode but for use as array with associative keys to prevent double inclusion of JS code. a ':''); } /** * Creates the bodyTag. * You can add to the bodyTag by $this->bodyTagAdditions * * @return string HTML body tag */ function docBodyTagBegin() { $bodyContent = 'body '.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(' ',$this->inDocStylesArray); // The default color scheme should also in full be represented in the stylesheet. $style=trim(' '.($this->styleSheetFile?'':'').' '.($this->styleSheetFile2?'':'').' '.($this->styleSheetFile_post?'':'') ) ; $this->inDocStyles=''; $this->inDocStylesArray=array(); return ' '.$style; } /** * 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 = "\n".implode("\n", $this->inDocStylesArray); $content = str_replace('/*###POSTCSSMARKER###*/',$styles,$content); // insert accumulated JS $jscode = $this->JScode."\n".$this->wrapScriptTags(implode("\n", $this->JScodeArray)); $content = str_replace('',$jscode,$content); return $content; } /** * 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.', http://typo3.com, © Kasper Skårhøj 1998-2005, extensions are copyright of their respective owners.'; 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 = 'gfx/icon_fatalerror.gif'; break; case '2': $icon = 'gfx/icon_warning.gif'; break; case '1': $icon = 'gfx/icon_note.gif'; break; case '-1': $icon = 'gfx/icon_ok.gif'; break; default: break; } if ($icon) { return 'backPath,$icon,'width="18" height="16"').' class="absmiddle"'.($styleAttribValue ? ' style="'.htmlspecialchars($styleAttribValue).'"' : '').' alt="" />'; } } /** * 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 $arr * * @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($arr, $layout='') { if (is_array($arr)) { $tableLayout = (is_array($layout)) ? $layout : $this->tableLayout; reset($arr); $code=''; $rc=0; while(list(,$val)=each($arr)) { if ($rc % 2) { $layout = is_array($tableLayout['defRowOdd']) ? $tableLayout['defRowOdd'] : $tableLayout['defRow']; } else { $layout = is_array($tableLayout['defRowEven']) ? $tableLayout['defRowEven'] : $tableLayout['defRow']; } $layoutRow = is_array($tableLayout[$rc]) ? $tableLayout[$rc] : $layout; $code_td=''; if (is_array($val)) { $cc=0; while(list(,$content)=each($val)) { $wrap= is_array($layoutRow[$cc]) ? $layoutRow[$cc] : (is_array($layoutRow['defCol']) ? $layoutRow['defCol'] : (is_array($layout[$cc]) ? $layout[$cc] : $layout['defCol'])); $code_td.=$wrap[0].$content.$wrap[1]; $cc++; } } $trWrap = is_array($layoutRow['tr']) ? $layoutRow['tr'] : (is_array($layout['tr']) ? $layout['tr'] : array($this->table_TR, '')); $code.=$trWrap[0].$code_td.$trWrap[1]; $rc++; } $tableWrap = is_array($tableLayout['table']) ? $tableLayout['table'] : array($this->table_TABLE, '
'); $code=$tableWrap[0].$code.$tableWrap[1]; } return $code; } /** * 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)>2) { return $af_content; } } /** * Returns an array with parts (JavaScript, init-functions,
-layers) for use on pages which displays the clickmenu layers (context sensitive menus) * * @return array If values are present: [0] = A '; return array( $content, ' onmousemove="GL_getMouse(event);" onload="initLayer();"', '' ); } else return array('','',''); } /** * Creates a tab menu from an array definition * * Returns a tab menu for a module * Requires the JS function jumpToUrl() to be available * * @param mixed $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=... * @param string $elementName it the form elements name, probably something like "SET[...]" * @param string $currentValue is the value to be selected currently. * @param array $menuItems is an array with the menu items for the selector box * @param string $script is the script to send the &id to, if empty it's automatically found * @param string $addParams is additional parameters to pass to the script. * @return string HTML code for tab menu * @author René Fritz */ function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') { $content=''; if (is_array($menuItems)) { if (!is_array($mainParams)) { $mainParams = array('id' => $mainParams); } $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams); if (!$script) {$script=basename(PATH_thisScript);} $menuDef = array(); foreach($menuItems as $value => $label) { $menuDef[$value]['isActive'] = !strcmp($currentValue,$value); $menuDef[$value]['label'] = t3lib_div::deHSCentities(htmlspecialchars($label)); $menuDef[$value]['url'] = htmlspecialchars($script.'?'.$mainParams.$addparams.'&'.$elementName.'='.$value); } $content = $this->getTabMenuRaw($menuDef); } return $content; } /** * Creates the HTML content for the tab menu * * @param array Menu items for tabs * @return string Table HTML * @access private */ function getTabMenuRaw($menuItems) { $content=''; if (is_array($menuItems)) { $options=''; $count = count($menuItems); $widthLeft = 1; $addToAct = 5; $widthRight = max (1,floor(30-pow($count,1.72))); $widthTabs = 100 - $widthRight - $widthLeft; $widthNo = floor(($widthTabs - $addToAct)/$count); $addToAct = max ($addToAct,$widthTabs-($widthNo*$count)); $widthAct = $widthNo + $addToAct; $widthRight = 100 - ($widthLeft + ($count*$widthNo) + $addToAct); $first=true; foreach($menuItems as $id => $def) { $isActive = $def['isActive']; $class = $isActive ? 'tabact' : 'tab'; $width = $isActive ? $widthAct : $widthNo; // @rene: Here you should probably wrap $label and $url in htmlspecialchars() in order to make sure its XHTML compatible! I did it for $url already since that is VERY likely to break. $label = $def['label']; $url = htmlspecialchars($def['url']); $params = $def['addParams']; if($first) { $options.= ' '.$label.''; } else { $options.=' '.$label.''; } $first=false; } if ($options) { $content .= ' '.$options.'
  
'; } } return $content; } /** * Creates a DYNAMIC tab-menu where the tabs are switched between with DHTML. * Should work in MSIE, Mozilla, Opera and Konqueror. On Konqueror I did find a serious problem: