*/ /** * [CLASS/FUNCTION INDEX of SCRIPT] * * 145: function fw($str) * * * 169: class template * 224: function template() * * 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() * * 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() * * 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) * * * 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."); require_once(PATH_t3lib.'class.t3lib_ajax.php'); /** * Deprecated fontwrap function. Is just transparent now. * * @param string Input string * @return string Output string (in the old days this was wrapped in tags) * @deprecated */ 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 $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. '; } // Construct page header. $str = $headerStart.' '.$charSet.' '.$generator.' '.htmlspecialchars($title).' '.$this->docStyle().' '.implode("\n", $this->JScodeLibArray).' '.$this->JScode.' '.$tabJScode.' '.$this->wrapScriptTags(implode("\n", $this->JScodeArray)).' '; $this->JScodeLibArray=array(); $this->JScode=''; $this->JScodeArray=array(); if ($this->docType=='xhtml_frames') { return $str; } else $str.=$this->docBodyTagBegin(). ($this->divClass?'
':'').trim($this->form); return $str; } /** * Returns page end; This includes finishing form, div, body and html tags. * * @return string The HTML end of a page * @see startPage() */ function endPage() { $str = $this->sectionEnd(). $this->postCode. $this->endPageJS(). t3lib_BEfunc::getSetUpdateSignal(). $this->parseTime(). ($this->form?' ':''); if ($this->docType!='xhtml_frames') { $str .= ($this->divClass?'
':'').' '; } $str .= ''; // Logging: Can't find better place to put it: if (TYPO3_DLOG) t3lib_div::devLog('END of BACKEND session','',0,array('_FLUSH'=>TRUE)); return $str; } /** * Returns the header-bar in the top of most backend modules * Closes section if open. * * @param string The text string for the header * @return string HTML content */ function header($text) { $str='

'.htmlspecialchars($text).'

'; return $this->sectionEnd().$str; } /** * Begins an output section and sets header and content * * @param string The header * @param string The HTML-content * @param boolean A flag that will prevent the header from being converted to uppercase * @param boolean Defines the type of header (if set, "

" rather than the default "h4") * @param integer The number of an icon to show with the header (see the icon-function). -1,1,2,3 * @param boolean If set, HTML tags are allowed in $label (otherwise this value is by default htmlspecialchars()'ed) * @return string HTML content * @see icons(), sectionHeader() */ function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE) { $str=''; // Setting header if ($label) { if (!$allowHTMLinHeader) $label = htmlspecialchars($label); $str.=$this->sectionHeader($this->icons($type).$label, $sH, $nostrtoupper ? '' : ' class="uppercase"'); } // Setting content $str.=' '.$text; return $this->sectionBegin().$str; } /** * Inserts a divider image * Ends a section (if open) before inserting the image * * @param integer The margin-top/-bottom of the
ruler. * @return string HTML content */ function divider($dist) { $dist = intval($dist); $str='
'; return $this->sectionEnd().$str; } /** * Returns a blank
-section with a height * * @param integer Padding-top for the div-section (should be margin-top but konqueror (3.1) doesn't like it :-( * @return string HTML content */ function spacer($dist) { if ($dist>0) { return '
'; } } /** * Make a section header. * Begins a section if not already open. * * @param string The label between the

or

tags. (Allows HTML) * @param boolean If set,

is used, otherwise

* @param string Additional attributes to h-tag, eg. ' class=""' * @return string HTML content */ function sectionHeader($label,$sH=FALSE,$addAttrib='') { $tag = ($sH?'h3':'h4'); $str=' <'.$tag.$addAttrib.'>'.$label.' '; return $this->sectionBegin().$str; } /** * Begins an output section. * Returns the
-begin tag AND sets the ->sectionFlag true (if the ->sectionFlag is not already set!) * You can call this function even if a section is already begun since the function will only return something if the sectionFlag is not already set! * * @return string HTML content */ function sectionBegin() { if (!$this->sectionFlag) { $this->sectionFlag=1; $str='
'; return $str; } else return ''; } /** * Ends and output section * Returns the
-end tag AND clears the ->sectionFlag (but does so only IF the sectionFlag is set - that is a section is 'open') * See sectionBegin() also. * * @return string HTML content */ function sectionEnd() { if ($this->sectionFlag) { $this->sectionFlag=0; return '
'; } else return ''; } /** * Originally it printed a kind of divider. * Deprecated. Just remove function calls to it or call the divider() function instead. * * @return void * @internal * @deprecated */ function middle() { } /** * If a form-tag is defined in ->form then and end-tag for that
element is outputted * Further a JavaScript section is outputted which will update the top.busy session-expiry object (unless $this->endJS is set to false) * * @return string HTML content (':''); } /** * 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(' ',$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-2006, 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)>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) { if (!isset($this->JScodeLibArray[$lib])) { $this->JScodeLibArray[$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->loadJavascriptLib('contrib/prototype/prototype.js'); $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; } /** * Returns dynamic tab menu header JS code. * * @return string JavaScript section for the HTML header. */ function getDynTabMenuJScode() { return ' '; } /** * 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 */ function getVersionSelector($id,$noAction=FALSE) { if ($id>0) { if (t3lib_extMgm::isLoaded('version') && $GLOBALS['BE_USER']->workspace==0) { // Get Current page record: $curPage = t3lib_BEfunc::getRecord('pages',$id); // If the selected page is not online, find the right ID $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id); // Select all versions of online version: $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id'); // If more than one was found...: if (count($versions)>1) { // Create selector box entries: $opt = array(); foreach($versions as $vRow) { $opt[] = ''; } // Add management link: $opt[] = ''; $opt[] = ''; // Create onchange handler: $onChange = "window.location.href=this.options[this.selectedIndex].value;"; // Controls: if ($id==$onlineId) { $controls = 'backPath,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="absmiddle" alt="" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online',1).''; } elseif (!$noAction) { $controls = ''. 'backPath,'gfx/insert1.gif','width="14" height="14"').' style="margin-right: 2px;" class="absmiddle" alt="" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swapPage',1).'" />'. ''.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap',1).''; } // Write out HTML code: return '
'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.selVer',1).' '.$controls.'
'; } } elseif ($GLOBALS['BE_USER']->workspace!==0) { // Write out HTML code: switch($GLOBALS['BE_USER']->workspace) { case 0: $wsTitle = 'LIVE'; break; case -1: $wsTitle = 'Draft'; break; default: $wsTitle = $GLOBALS['BE_USER']->workspaceRec['title']; break; } if (t3lib_BEfunc::isPidInVersionizedBranch($id)=='branchpoint') { return '
Workspace: "'.htmlspecialchars($wsTitle).'" Inside branch, no further versioning possible
'; } else { // Get Current page record: $curPage = t3lib_BEfunc::getRecord('pages',$id); // If the selected page is not online, find the right ID $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id); // The version of page: $verPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'pages', $onlineId); if (!$verPage) { if (!count(t3lib_BEfunc::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $onlineId))) { if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) { $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=new&cmd[pages]['.$onlineId.'][version][treeLevels]=0',t3lib_div::linkThisScript(array('id'=>$onlineId))); $onClick = 'window.location.href=\''.$onClick.'\'; return false;'; // Write out HTML code: return '
Workspace: "'.htmlspecialchars($wsTitle).'"
'; } } else { return '
Workspace: "'.htmlspecialchars($wsTitle).'" Versions found on page, no "Page" versioning possible
'; } } elseif ($verPage['t3ver_swapmode']==0) { $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=swap&cmd[pages]['.$onlineId.'][version][swapWith]='.$verPage['uid'],t3lib_div::linkThisScript(array('id'=>$onlineId))); $onClick = 'window.location.href=\''.$onClick.'\'; return false;'; // Write out HTML code: return '
Workspace: "'.htmlspecialchars($wsTitle).'"
'; } } } } } } // ****************************** // 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. * */ 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. * */ 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. * */ 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. * */ class mediumDoc extends template { var $divClass = 'typo3-mediumDoc'; } // Include extension to the template class? if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']); } // ****************************************************** // The backend language engine is started (ext: "lang") // ****************************************************** require_once(PATH_typo3.'sysext/lang/lang.php'); $GLOBALS['LANG'] = t3lib_div::makeInstance('language'); $GLOBALS['LANG']->init($BE_USER->uc['lang']); // ****************************** // The template is loaded // ****************************** $GLOBALS['TBE_TEMPLATE'] = t3lib_div::makeInstance('template'); ?>