template.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Contains class with layout/output function for TYPO3 Backend Scripts
00029  *
00030  * $Id: template.php 4570 2008-12-18 18:37:14Z steffenk $
00031  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
00032  * XHTML-trans compliant
00033  *
00034  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00035  */
00036 /**
00037  * [CLASS/FUNCTION INDEX of SCRIPT]
00038  *
00039  *  145: function fw($str)
00040  *
00041  *
00042  *  169: class template
00043  *  224:     function template()
00044  *
00045  *              SECTION: EVALUATION FUNCTIONS
00046  *  298:     function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE)
00047  *  315:     function viewPageIcon($id,$backPath,$addParams='hspace="3"')
00048  *  341:     function issueCommand($params,$rUrl='')
00049  *  356:     function isCMlayers()
00050  *  366:     function thisBlur()
00051  *  376:     function helpStyle()
00052  *  393:     function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('',''))
00053  *  419:     function getFileheader($title,$path,$iconfile)
00054  *  434:     function makeShortcutIcon($gvList,$setList,$modName,$motherModName="")
00055  *  467:     function makeShortcutUrl($gvList,$setList)
00056  *  488:     function formWidth($size=48,$textarea=0,$styleOverride='')
00057  *  513:     function formWidthText($size=48,$styleOverride='',$wrap='')
00058  *  530:     function redirectUrls($thisLocation='')
00059  *  554:     function formatTime($tstamp,$type)
00060  *  571:     function parseTime()
00061  *
00062  *              SECTION: PAGE BUILDING FUNCTIONS.
00063  *  604:     function startPage($title)
00064  *  686:     function endPage()
00065  *  720:     function header($text)
00066  *  741:     function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE)
00067  *  765:     function divider($dist)
00068  *  781:     function spacer($dist)
00069  *  800:     function sectionHeader($label,$sH=FALSE,$addAttrib='')
00070  *  817:     function sectionBegin()
00071  *  838:     function sectionEnd()
00072  *  858:     function middle()
00073  *  867:     function endPageJS()
00074  *  884:     function docBodyTagBegin()
00075  *  894:     function docStyle()
00076  *  936:     function insertStylesAndJS($content)
00077  *  956:     function initCharset()
00078  *  968:     function generator()
00079  *
00080  *              SECTION: OTHER ELEMENTS
00081  * 1001:     function icons($type, $styleAttribValue='')
00082  * 1030:     function t3Button($onClick,$label)
00083  * 1041:     function dfw($string)
00084  * 1051:     function rfw($string)
00085  * 1061:     function wrapInCData($string)
00086  * 1078:     function wrapScriptTags($string, $linebreak=TRUE)
00087  * 1117:     function table($arr, $layout='')
00088  * 1159:     function menuTable($arr1,$arr2=array(), $arr3=array())
00089  * 1192:     function funcMenu($content,$menu)
00090  * 1210:     function clearCacheMenu($id,$addSaveOptions=0)
00091  * 1246:     function getContextMenuCode()
00092  * 1251:     function showClickmenu(table, uid, listFr, enDisItems, backPath, addParams)
00093  * 1280:     function showClickmenu_noajax(url)
00094  * 1287:     function showClickmenu_ajax(t3ajax)
00095  * 1472:     function getDragDropCode($table)
00096  * 1483:     function cancelDragEvent(event)
00097  * 1496:     function mouseMoveEvent (event)
00098  * 1509:     function dragElement(id,elementID)
00099  * 1528:     function dropElement(id)
00100  * 1577:     function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='')
00101  * 1607:     function getTabMenuRaw($menuItems)
00102  * 1676:     function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1)
00103  * 1801:     function getDynTabMenuJScode()
00104  * 1892:     function getVersionSelector($id,$noAction=FALSE)
00105  *
00106  *
00107  * 2060: class bigDoc extends template
00108  *
00109  *
00110  * 2069: class noDoc extends template
00111  *
00112  *
00113  * 2078: class smallDoc extends template
00114  *
00115  *
00116  * 2087: class mediumDoc extends template
00117  *
00118  * TOTAL FUNCTIONS: 57
00119  * (This index is automatically created/updated by the extension "extdeveval")
00120  *
00121  */
00122 
00123 
00124 
00125 if (!defined('TYPO3_MODE')) die("Can't include this file directly.");
00126 
00127 require_once(PATH_t3lib.'class.t3lib_ajax.php');
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 /**
00139  * Deprecated fontwrap function. Is just transparent now.
00140  *
00141  * @param   string      Input string
00142  * @return  string      Output string (in the old days this was wrapped in <font> tags)
00143  * @deprecated since TYPO3 4.0
00144  */
00145 function fw($str)   {
00146     return $str;
00147 }
00148 
00149 
00150 /**
00151  * TYPO3 Backend Template Class
00152  *
00153  * This class contains functions for starting and ending the HTML of backend modules
00154  * It also contains methods for outputting sections of content.
00155  * Further there are functions for making icons, links, setting form-field widths etc.
00156  * Color scheme and stylesheet definitions are also available here.
00157  * Finally this file includes the language class for TYPO3's backend.
00158  *
00159  * After this file $LANG and $TBE_TEMPLATE are global variables / instances of their respective classes.
00160  * This file is typically included right after the init.php file,
00161  * if language and layout is needed.
00162  *
00163  * Please refer to Inside TYPO3 for a discussion of how to use this API.
00164  *
00165  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00166  * @package TYPO3
00167  * @subpackage core
00168  */
00169 class template {
00170 
00171         // Vars you typically might want to/should set from outside after making instance of this class:
00172     var $backPath = '';             // 'backPath' pointing back to the PATH_typo3
00173     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.
00174     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. <script>-Tags are not wrapped around automatically
00175     var $JScode='';                 // Additional header code (eg. a JavaScript section) could be accommulated in this var. It will be directly outputted in the header.
00176     var $JScodeArray = array();     // Similar to $JScode but for use as array with associative keys to prevent double inclusion of JS code. a <script> tag is automatically wrapped around.
00177     var $postCode='';               // Additional 'page-end' code could be accommulated in this var. It will be outputted at the end of page before </body> and some other internal page-end code.
00178     var $docType = '';              // Doc-type used in the header. Default is xhtml_trans. You can also set it to 'html_3', 'xhtml_strict' or 'xhtml_frames'.
00179     var $moduleTemplate = '';       // HTML template with markers for module
00180 
00181         // Other vars you can change, but less frequently used:
00182     var $scriptID='';               // Script ID.
00183     var $bodyTagId='';              // Id which can be set for the body tag. Default value is based on script ID
00184     var $bodyTagAdditions='';       // You can add additional attributes to the body-tag through this variable.
00185     var $inDocStyles='';            // Additional CSS styles which will be added to the <style> section in the header
00186     var $inDocStylesArray=array();      // Like $inDocStyles but for use as array with associative keys to prevent double inclusion of css code
00187     var $form_rowsToStylewidth = 9.58;  // Multiplication factor for formWidth() input size (default is 48* this value).
00188     var $form_largeComp = 1.33;     // Compensation for large documents (used in class.t3lib_tceforms.php)
00189     var $endJS=1;                   // If set, then a JavaScript section will be outputted in the bottom of page which will try and update the top.busy session expiry object.
00190     protected $additionalStyleSheets=array();   // Links to additional style sheets
00191 
00192         // TYPO3 Colorscheme.
00193         // If you want to change this, please do so through a skin using the global var $TBE_STYLES
00194     var $bgColor = '#F7F3EF';       // Light background color
00195     var $bgColor2 = '#9BA1A8';      // Steel-blue
00196     var $bgColor3 = '#F6F2E6';      // dok.color
00197     var $bgColor4 = '#D9D5C9';      // light tablerow background, brownish
00198     var $bgColor5 = '#ABBBB4';      // light tablerow background, greenish
00199     var $bgColor6 = '#E7DBA8';      // light tablerow background, yellowish, for section headers. Light.
00200     var $hoverColor = '#254D7B';
00201     var $styleSheetFile = 'stylesheet.css'; // Filename of stylesheet (relative to PATH_typo3)
00202     var $styleSheetFile2 = '';      // Filename of stylesheet #2 - linked to right after the $this->styleSheetFile script (relative to PATH_typo3)
00203     var $styleSheetFile_post = '';  // Filename of a post-stylesheet - included right after all inline styles.
00204     var $backGroundImage = '';      // Background image of page (relative to PATH_typo3)
00205     var $inDocStyles_TBEstyle = ''; // Inline css styling set from TBE_STYLES array
00206 
00207         // DEV:
00208     var $parseTimeFlag = 0;         // Will output the parsetime of the scripts in milliseconds (for admin-users). Set this to false when releasing TYPO3. Only for dev.
00209 
00210         // INTERNAL
00211     var $charset = 'iso-8859-1';    // Default charset. see function initCharset()
00212 
00213     var $sectionFlag=0;             // Internal: Indicates if a <div>-output section is open
00214     var $divClass = '';             // (Default) Class for wrapping <DIV>-tag of page. Is set in class extensions.
00215 
00216 
00217 
00218 
00219 
00220 
00221     /**
00222      * Constructor
00223      * Imports relevant parts from global $TBE_STYLES (colorscheme)
00224      *
00225      * @return  void
00226      */
00227     function template() {
00228         global $TBE_STYLES;
00229 
00230             // Setting default scriptID:
00231         if (($temp_M = (string) t3lib_div::_GET('M')) && $GLOBALS['TBE_MODULES']['_PATHS'][$temp_M]) {
00232             $this->scriptID = ereg_replace('^.*\/(sysext|ext)\/', 'ext/', $GLOBALS['TBE_MODULES']['_PATHS'][$temp_M] . 'index.php');
00233         } else {
00234             $this->scriptID = ereg_replace('^.*\/(sysext|ext)\/', 'ext/', substr(PATH_thisScript, strlen(PATH_site)));
00235         }
00236         if (TYPO3_mainDir!='typo3/' && substr($this->scriptID,0,strlen(TYPO3_mainDir)) == TYPO3_mainDir)    {
00237             $this->scriptID = 'typo3/'.substr($this->scriptID,strlen(TYPO3_mainDir));   // This fixes if TYPO3_mainDir has been changed so the script ids are STILL "typo3/..."
00238         }
00239 
00240         $this->bodyTagId = ereg_replace('[^[:alnum:]-]','-',$this->scriptID);
00241 
00242             // Individual configuration per script? If so, make a recursive merge of the arrays:
00243         if (is_array($TBE_STYLES['scriptIDindex'][$this->scriptID]))    {
00244             $ovr = $TBE_STYLES['scriptIDindex'][$this->scriptID];       // Make copy
00245             $TBE_STYLES = t3lib_div::array_merge_recursive_overrule($TBE_STYLES,$ovr);      // merge styles.
00246             unset($TBE_STYLES['scriptIDindex'][$this->scriptID]);   // Have to unset - otherwise the second instantiation will do it again!
00247         }
00248 
00249             // Color scheme:
00250         if ($TBE_STYLES['mainColors']['bgColor'])   $this->bgColor=$TBE_STYLES['mainColors']['bgColor'];
00251         if ($TBE_STYLES['mainColors']['bgColor1'])  $this->bgColor1=$TBE_STYLES['mainColors']['bgColor1'];
00252         if ($TBE_STYLES['mainColors']['bgColor2'])  $this->bgColor2=$TBE_STYLES['mainColors']['bgColor2'];
00253         if ($TBE_STYLES['mainColors']['bgColor3'])  $this->bgColor3=$TBE_STYLES['mainColors']['bgColor3'];
00254         if ($TBE_STYLES['mainColors']['bgColor4'])  $this->bgColor4=$TBE_STYLES['mainColors']['bgColor4'];
00255         if ($TBE_STYLES['mainColors']['bgColor5'])  $this->bgColor5=$TBE_STYLES['mainColors']['bgColor5'];
00256         if ($TBE_STYLES['mainColors']['bgColor6'])  $this->bgColor6=$TBE_STYLES['mainColors']['bgColor6'];
00257         if ($TBE_STYLES['mainColors']['hoverColor'])    $this->hoverColor=$TBE_STYLES['mainColors']['hoverColor'];
00258 
00259             // Main Stylesheets:
00260         if ($TBE_STYLES['stylesheet'])  $this->styleSheetFile = $TBE_STYLES['stylesheet'];
00261         if ($TBE_STYLES['stylesheet2']) $this->styleSheetFile2 = $TBE_STYLES['stylesheet2'];
00262         if ($TBE_STYLES['styleSheetFile_post']) $this->styleSheetFile_post = $TBE_STYLES['styleSheetFile_post'];
00263         if ($TBE_STYLES['inDocStyles_TBEstyle'])    $this->inDocStyles_TBEstyle = $TBE_STYLES['inDocStyles_TBEstyle'];
00264 
00265             // Background image
00266         if ($TBE_STYLES['background'])  $this->backGroundImage = $TBE_STYLES['background'];
00267     }
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 
00276 
00277 
00278 
00279 
00280 
00281 
00282 
00283 
00284     /*****************************************
00285      *
00286      * EVALUATION FUNCTIONS
00287      * Various centralized processing
00288      *
00289      *****************************************/
00290 
00291     /**
00292      * Makes click menu link (context sensitive menu)
00293      * Returns $str (possibly an <|img> tag/icon) wrapped in a link which will activate the context sensitive menu for the record ($table/$uid) or file ($table = file)
00294      * The link will load the top frame with the parameter "&item" which is the table,uid and listFr arguments imploded by "|": rawurlencode($table.'|'.$uid.'|'.$listFr)
00295      *
00296      * @param   string      String to be wrapped in link, typ. image tag.
00297      * @param   string      Table name/File path. If the icon is for a database record, enter the tablename from $TCA. If a file then enter the absolute filepath
00298      * @param   integer     If icon is for database record this is the UID for the record from $table
00299      * @param   boolean     Tells the top frame script that the link is coming from a "list" frame which means a frame from within the backend content frame.
00300      * @param   string      Additional GET parameters for the link to alt_clickmenu.php
00301      * @param   string      Enable / Disable click menu items. Example: "+new,view" will display ONLY these two items (and any spacers in between), "new,view" will display all BUT these two items.
00302      * @param   boolean     If set, will return only the onclick JavaScript, not the whole link.
00303      * @return  string      The link-wrapped input string.
00304      */
00305     function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE)  {
00306         $backPath = rawurlencode($this->backPath).'|'.t3lib_div::shortMD5($this->backPath.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
00307         $onClick = 'showClickmenu("'.$table.'","'.$uid.'","'.$listFr.'","'.str_replace('+','%2B',$enDisItems).'","'.str_replace('&','&amp;',addcslashes($backPath,'"')).'","'.str_replace('&','&amp;',addcslashes($addParams,'"')).'");return false;';
00308         return $returnOnClick ? $onClick : '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'] ? ' oncontextmenu="'.htmlspecialchars($onClick).'"' : '').'>'.$str.'</a>';
00309     }
00310 
00311     /**
00312      * Makes link to page $id in frontend (view page)
00313      * Returns an magnifier-glass icon which links to the frontend index.php document for viewing the page with id $id
00314      * $id must be a page-uid
00315      * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url)
00316      *
00317      * @param   integer     The page id
00318      * @param   string      The current "BACK_PATH" (the back relative to the typo3/ directory)
00319      * @param   string      Additional parameters for the image tag(s)
00320      * @return  string      HTML string with linked icon(s)
00321      */
00322     function viewPageIcon($id,$backPath,$addParams='hspace="3"')    {
00323         global $BE_USER;
00324         $str = '';
00325             // If access to Web>List for user, then link to that module.
00326         if ($BE_USER->check('modules','web_list'))  {
00327             $href=$backPath.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
00328             $str.= '<a href="'.htmlspecialchars($href).'">'.
00329                     '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/list.gif','width="11" height="11"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList',1).'"'.($addParams?' '.trim($addParams):'').' alt="" />'.
00330                     '</a>';
00331         }
00332             // Make link to view page
00333         $str.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($id,$backPath,t3lib_BEfunc::BEgetRootLine($id))).'">'.
00334                 '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'"'.($addParams?' '.trim($addParams):"").' hspace="3" alt="" />'.
00335                 '</a>';
00336         return $str;
00337     }
00338 
00339     /**
00340      * Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
00341      * See description of the API elsewhere.
00342      *
00343      * @param   string      $params is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World"
00344      * @param   string      Redirect URL if any other that t3lib_div::getIndpEnv('REQUEST_URI') is wished
00345      * @return  string      URL to tce_db.php + parameters (backpath is taken from $this->backPath)
00346      * @see t3lib_BEfunc::editOnClick()
00347      */
00348     function issueCommand($params,$rUrl='') {
00349         $rUrl = $rUrl ? $rUrl : t3lib_div::getIndpEnv('REQUEST_URI');
00350         return $this->backPath.'tce_db.php?'.
00351                 $params.
00352                 '&redirect='.($rUrl==-1?"'+T3_THIS_LOCATION+'":rawurlencode($rUrl)).
00353                 '&vC='.rawurlencode($GLOBALS['BE_USER']->veriCode()).
00354                 '&prErr=1&uPT=1';
00355     }
00356 
00357     /**
00358      * Returns true if click-menu layers can be displayed for the current user/browser
00359      * Use this to test if click-menus (context sensitive menus) can and should be displayed in the backend.
00360      *
00361      * @return  boolean
00362      */
00363     function isCMlayers()   {
00364         return !$GLOBALS['BE_USER']->uc['disableCMlayers'] && $GLOBALS['CLIENT']['FORMSTYLE'] && !($GLOBALS['CLIENT']['SYSTEM']=='mac' && $GLOBALS['CLIENT']['BROWSER']=='Opera');
00365     }
00366 
00367     /**
00368      * Returns 'this.blur();' if the client supports CSS styles
00369      * Use this in links to remove the underlining after being clicked
00370      *
00371      * @return  string
00372      */
00373     function thisBlur() {
00374         return ($GLOBALS['CLIENT']['FORMSTYLE']?'this.blur();':'');
00375     }
00376 
00377     /**
00378      * Returns ' style='cursor:help;'' if the client supports CSS styles
00379      * Use for <a>-links to help texts
00380      *
00381      * @return  string
00382      */
00383     function helpStyle()    {
00384         return $GLOBALS['CLIENT']['FORMSTYLE'] ? ' style="cursor:help;"':'';
00385     }
00386 
00387     /**
00388      * Makes the header (icon+title) for a page (or other record). Used in most modules under Web>*
00389      * $table and $row must be a tablename/record from that table
00390      * $path will be shown as alt-text for the icon.
00391      * The title will be truncated to 45 chars.
00392      *
00393      * @param   string      Table name
00394      * @param   array       Record row
00395      * @param   string      Alt text
00396      * @param   boolean     Set $noViewPageIcon true if you don't want a magnifier-icon for viewing the page in the frontend
00397      * @param   array       $tWrap is an array with indexes 0 and 1 each representing HTML-tags (start/end) which will wrap the title
00398      * @return  string      HTML content
00399      */
00400     function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('','')) {
00401         global $TCA;
00402         if (is_array($row) && $row['uid'])  {
00403             $iconImgTag=t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($path).'"');
00404             $title= strip_tags($row[$TCA[$table]['ctrl']['label']]);
00405             $viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'],$this->backPath,'');
00406             if ($table=='pages')    $path.=' - '.t3lib_BEfunc::titleAttribForPages($row,'',0);
00407         } else {
00408             $iconImgTag='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif',$wHattribs='width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />';
00409             $title=$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
00410         }
00411 
00412         return '<span class="typo3-moduleHeader">'.$this->wrapClickMenuOnIcon($iconImgTag,$table,$row['uid']).
00413                 $viewPage.
00414                 $tWrap[0].htmlspecialchars(t3lib_div::fixed_lgd_cs($title,45)).$tWrap[1].'</span>';
00415     }
00416 
00417     /**
00418      * Like ->getHeader() but for files in the File>* main module/submodules
00419      * Returns the file-icon with the path of the file set in the alt/title attribute. Shows the file-name after the icon.
00420      *
00421      * @param   string      Title string, expected to be the filepath
00422      * @param   string      Alt text
00423      * @param   string      The icon file (relative to TYPO3 dir)
00424      * @return  string      HTML content
00425      */
00426     function getFileheader($title,$path,$iconfile)  {
00427         $fileInfo = t3lib_div::split_fileref($title);
00428         $title = htmlspecialchars(t3lib_div::fixed_lgd_cs($fileInfo['path'],-35)).'<b>'.htmlspecialchars($fileInfo['file']).'</b>';
00429         return '<span class="typo3-moduleHeader"><img'.t3lib_iconWorks::skinImg($this->backPath,$iconfile,'width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />'.$title.'</span>';
00430     }
00431 
00432     /**
00433      * Returns a linked shortcut-icon which will call the shortcut frame and set a shortcut there back to the calling page/module
00434      *
00435      * @param   string      Is the list of GET variables to store (if any)
00436      * @param   string      Is the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
00437      * @param   string      Module name string
00438      * @param   string      Is used to enter the "parent module name" if the module is a submodule under eg. Web>* or File>*. You can also set this value to "1" in which case the currentLoadedModule is sent to the shortcut script (so - not a fixed value!) - that is used in file_edit.php and wizard_rte.php scripts where those scripts are really running as a part of another module.
00439      * @return  string      HTML content
00440      */
00441     function makeShortcutIcon($gvList,$setList,$modName,$motherModName="")  {
00442         $backPath=$this->backPath;
00443         $storeUrl=$this->makeShortcutUrl($gvList,$setList);
00444         $pathInfo = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00445 
00446             // Add the module identifier automatically if typo3/mod.php is used:
00447         if (ereg('typo3/mod\.php$', $pathInfo['path']) && isset($GLOBALS['TBE_MODULES']['_PATHS'][$modName])) {
00448             $storeUrl = '&M='.$modName.$storeUrl;
00449         }
00450 
00451         if (!strcmp($motherModName,'1'))    {
00452             $mMN="&motherModName='+top.currentModuleLoaded+'";
00453         } elseif ($motherModName)   {
00454             $mMN='&motherModName='.rawurlencode($motherModName);
00455         } else $mMN='';
00456 
00457         $onClick = 'top.ShortcutManager.createShortcut('
00458             .$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut')).', '
00459             .'\''.$backPath.'\', '
00460             .'\''.rawurlencode($modName).'\', '
00461             .'\''.rawurlencode($pathInfo['path']."?".$storeUrl).$mMN.'\''
00462         .');return false;';
00463 
00464         $sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut',1).'" alt="" /></a>';
00465         return $sIcon;
00466     }
00467 
00468     /**
00469      * MAKE url for storing
00470      * Internal func
00471      *
00472      * @param   string      Is the list of GET variables to store (if any)
00473      * @param   string      Is the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
00474      * @return  string
00475      * @access private
00476      * @see makeShortcutIcon()
00477      */
00478     function makeShortcutUrl($gvList,$setList)  {
00479         $GET = t3lib_div::_GET();
00480         $storeArray = array_merge(
00481             t3lib_div::compileSelectedGetVarsFromArray($gvList,$GET),
00482             array('SET'=>t3lib_div::compileSelectedGetVarsFromArray($setList, (array)$GLOBALS['SOBE']->MOD_SETTINGS))
00483         );
00484         $storeUrl = t3lib_div::implodeArrayForUrl('',$storeArray);
00485         return $storeUrl;
00486     }
00487 
00488     /**
00489      * Returns <input> attributes to set the width of an text-type input field.
00490      * For client browsers with no CSS support the cols/size attribute is returned.
00491      * For CSS compliant browsers (recommended) a ' style="width: ...px;"' is returned.
00492      *
00493      * @param   integer     A relative number which multiplied with approx. 10 will lead to the width in pixels
00494      * @param   boolean     A flag you can set for textareas - DEPRECATED, use ->formWidthText() for textareas!!!
00495      * @param   string      A string which will be returned as attribute-value for style="" instead of the calculated width (if CSS is enabled)
00496      * @return  string      Tag attributes for an <input> tag (regarding width)
00497      * @see formWidthText()
00498      */
00499     function formWidth($size=48,$textarea=0,$styleOverride='') {
00500         $wAttrib = $textarea?'cols':'size';
00501         if (!$GLOBALS['CLIENT']['FORMSTYLE'])   {   // If not setting the width by style-attribute
00502             $size = $size;
00503             $retVal = ' '.$wAttrib.'="'.$size.'"';
00504         } else {    // Setting width by style-attribute. 'cols' MUST be avoided with NN6+
00505             $pixels = ceil($size*$this->form_rowsToStylewidth);
00506             $retVal = $styleOverride ? ' style="'.$styleOverride.'"' : ' style="width:'.$pixels.'px;"';
00507         }
00508         return $retVal;
00509     }
00510 
00511     /**
00512      * This function is dedicated to textareas, which has the wrapping on/off option to observe.
00513      * EXAMPLE:
00514      *      <textarea rows="10" wrap="off" '.$GLOBALS["TBE_TEMPLATE"]->formWidthText(48,"","off").'>
00515      *   or
00516      *      <textarea rows="10" wrap="virtual" '.$GLOBALS["TBE_TEMPLATE"]->formWidthText(48,"","virtual").'>
00517      *
00518      * @param   integer     A relative number which multiplied with approx. 10 will lead to the width in pixels
00519      * @param   string      A string which will be returned as attribute-value for style="" instead of the calculated width (if CSS is enabled)
00520      * @param   string      Pass on the wrap-attribute value you use in your <textarea>! This will be used to make sure that some browsers will detect wrapping alright.
00521      * @return  string      Tag attributes for an <input> tag (regarding width)
00522      * @see formWidth()
00523      */
00524     function formWidthText($size=48,$styleOverride='',$wrap='') {
00525         $wTags = $this->formWidth($size,1,$styleOverride);
00526             // Netscape 6+/Mozilla seems to have this ODD problem where there WILL ALWAYS be wrapping with the cols-attribute set and NEVER without the col-attribute...
00527         if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) {
00528             $wTags.=' cols="'.$size.'"';
00529         }
00530         return $wTags;
00531     }
00532 
00533     /**
00534      * Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page.
00535      * Used in fx. db_list.php (Web>List)
00536      *
00537      * @param   string      URL to "this location" / current script
00538      * @return  string
00539      * @see typo3/db_list.php
00540      */
00541     function redirectUrls($thisLocation='') {
00542         $thisLocation = $thisLocation?$thisLocation:t3lib_div::linkThisScript(
00543         array(
00544             'CB'=>'',
00545             'SET'=>'',
00546             'cmd' => '',
00547             'popViewId'=>''
00548         ));
00549 
00550         $out ="
00551     var T3_RETURN_URL = '".str_replace('%20','',rawurlencode(t3lib_div::_GP('returnUrl')))."';
00552     var T3_THIS_LOCATION = '".str_replace('%20','',rawurlencode($thisLocation))."';
00553         ";
00554         return $out;
00555     }
00556 
00557     /**
00558      * Returns a formatted string of $tstamp
00559      * Uses $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] and $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] to format date and time
00560      *
00561      * @param   integer     UNIX timestamp, seconds since 1970
00562      * @param   integer     How much data to show: $type = 1: hhmm, $type = 10: ddmmmyy
00563      * @return  string      Formatted timestamp
00564      */
00565     function formatTime($tstamp,$type)  {
00566         $dateStr = '';
00567         switch($type)   {
00568             case 1: $dateStr = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$tstamp);
00569             break;
00570             case 10: $dateStr = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp);
00571             break;
00572         }
00573         return $dateStr;
00574     }
00575 
00576     /**
00577      * Returns script parsetime IF ->parseTimeFlag is set and user is "admin"
00578      * Automatically outputted in page end
00579      *
00580      * @return  string
00581      */
00582     function parseTime()    {
00583         if ($this->parseTimeFlag && $GLOBALS['BE_USER']->isAdmin()) {
00584             return '<p>(ParseTime: '.(t3lib_div::milliseconds()-$GLOBALS['PARSETIME_START']).' ms</p>
00585                     <p>REQUEST_URI-length: '.strlen(t3lib_div::getIndpEnv('REQUEST_URI')).')</p>';
00586         }
00587     }
00588 
00589 
00590 
00591 
00592 
00593 
00594 
00595 
00596 
00597 
00598 
00599 
00600     /*****************************************
00601      *
00602      *  PAGE BUILDING FUNCTIONS.
00603      *  Use this to build the HTML of your backend modules
00604      *
00605      *****************************************/
00606 
00607     /**
00608      * Returns page start
00609      * This includes the proper header with charset, title, meta tag and beginning body-tag.
00610      *
00611      * @param   string      HTML Page title for the header
00612      * @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)
00613      * @see endPage()
00614      */
00615     function startPage($title)  {
00616             // hook pre start page
00617         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'])) {
00618             $preStartPageHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'];
00619             if (is_array($preStartPageHook)) {
00620                 $hookParameters = array(
00621                     'title' => &$title,
00622                 );
00623                 foreach ($preStartPageHook as $hookFunction)    {
00624                     t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
00625                 }
00626             }
00627         }
00628 
00629             // Get META tag containing the currently selected charset for backend output. The function sets $this->charSet.
00630         $charSet = $this->initCharset();
00631         $generator = $this->generator();
00632 
00633             // For debugging: If this outputs "QuirksMode"/"BackCompat" (IE) the browser runs in quirks-mode. Otherwise the value is "CSS1Compat"
00634 #       $this->JScodeArray[]='alert(document.compatMode);';
00635 
00636             // Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003
00637         header ('Content-Type:text/html;charset='.$this->charset);
00638 
00639         switch($this->docType)  {
00640             case 'html_3':
00641                 $headerStart = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
00642                 break;
00643             case 'xhtml_strict':
00644                 $headerStart = '<!DOCTYPE html
00645     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
00646     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
00647 <?xml version="1.0" encoding="'.$this->charset.'"?>
00648 <?xml-stylesheet href="#internalStyle" type="text/css"?>
00649 ';
00650                 break;
00651             case 'xhtml_frames':
00652                 $headerStart = '<!DOCTYPE html
00653      PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
00654      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
00655 <?xml version="1.0" encoding="'.$this->charset.'"?>
00656 ';
00657                 break;
00658             // The fallthrough is intended as XHTML 1.0 transitional is the default for the BE.
00659             case 'xhtml_trans':
00660             default:
00661                 $headerStart = '<!DOCTYPE html
00662      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00663      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00664 <?xml version="1.0" encoding="'.$this->charset.'"?>
00665 <?xml-stylesheet href="#internalStyle" type="text/css"?>
00666 ';
00667         }
00668 
00669         // This loads the tabulator-in-textarea feature. It automatically modifies
00670         // every textarea which is found.
00671         if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) {
00672             $this->loadJavascriptLib('tab.js');
00673         }
00674 
00675             // Construct page header.
00676         $str = $headerStart.'
00677 <html>
00678 <head>
00679     <!-- TYPO3 Script ID: '.htmlspecialchars($this->scriptID).' -->
00680     '.$charSet.'
00681     '.$generator.'
00682     <title>'.htmlspecialchars($title).'</title>
00683     '.$this->docStyle().'
00684     '.implode("\n", $this->JScodeLibArray).'
00685     '.$this->JScode.'
00686     '.$this->wrapScriptTags(implode("\n", $this->JScodeArray)).'
00687     <!--###POSTJSMARKER###-->
00688 </head>
00689 ';
00690         $this->JScodeLibArray=array();
00691         $this->JScode='';
00692         $this->JScodeArray=array();
00693 
00694         if ($this->docType=='xhtml_frames') {
00695             return $str;
00696         } else
00697 $str.=$this->docBodyTagBegin().
00698 ($this->divClass?'
00699 
00700 <!-- Wrapping DIV-section for whole page BEGIN -->
00701 <div class="'.$this->divClass.'">
00702 ':'').trim($this->form);
00703         return $str;
00704     }
00705 
00706     /**
00707      * Returns page end; This includes finishing form, div, body and html tags.
00708      *
00709      * @return  string      The HTML end of a page
00710      * @see startPage()
00711      */
00712     function endPage()  {
00713         $str = $this->sectionEnd().
00714                 $this->postCode.
00715                 $this->endPageJS().
00716                 $this->wrapScriptTags(t3lib_BEfunc::getUpdateSignalCode()).
00717                 $this->parseTime().
00718                 ($this->form?'
00719 </form>':'');
00720 
00721         if ($this->docType!='xhtml_frames') {
00722 
00723             $str .= ($this->divClass?'
00724 
00725 <!-- Wrapping DIV-section for whole page END -->
00726 </div>':'').'
00727 </body> ';
00728 
00729         }
00730 
00731         $str .= '</html>';
00732 
00733             // Logging: Can't find better place to put it:
00734         if (TYPO3_DLOG) t3lib_div::devLog('END of BACKEND session', 'template', 0, array('_FLUSH' => true));
00735 
00736         return $str;
00737     }
00738 
00739     /**
00740      * Returns the header-bar in the top of most backend modules
00741      * Closes section if open.
00742      *
00743      * @param   string      The text string for the header
00744      * @return  string      HTML content
00745      */
00746     function header($text)  {
00747         $str='
00748 
00749     <!-- MAIN Header in page top -->
00750     <h2>'.htmlspecialchars($text).'</h2>
00751 ';
00752         return $this->sectionEnd().$str;
00753     }
00754 
00755     /**
00756      * Begins an output section and sets header and content
00757      *
00758      * @param   string      The header
00759      * @param   string      The HTML-content
00760      * @param   boolean     A flag that will prevent the header from being converted to uppercase
00761      * @param   boolean     Defines the type of header (if set, "<h3>" rather than the default "h4")
00762      * @param   integer     The number of an icon to show with the header (see the icon-function). -1,1,2,3
00763      * @param   boolean     If set, HTML tags are allowed in $label (otherwise this value is by default htmlspecialchars()'ed)
00764      * @return  string      HTML content
00765      * @see icons(), sectionHeader()
00766      */
00767     function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE)   {
00768         $str='';
00769 
00770             // Setting header
00771         if ($label) {
00772             if (!$allowHTMLinHeader)    $label = htmlspecialchars($label);
00773             $str.=$this->sectionHeader($this->icons($type).$label, $sH, $nostrtoupper ? '' : ' class="uppercase"');
00774         }
00775             // Setting content
00776         $str.='
00777 
00778     <!-- Section content -->
00779 '.$text;
00780 
00781         return $this->sectionBegin().$str;
00782     }
00783 
00784     /**
00785      * Inserts a divider image
00786      * Ends a section (if open) before inserting the image
00787      *
00788      * @param   integer     The margin-top/-bottom of the <hr> ruler.
00789      * @return  string      HTML content
00790      */
00791     function divider($dist) {
00792         $dist = intval($dist);
00793         $str='
00794 
00795     <!-- DIVIDER -->
00796     <hr style="margin-top: '.$dist.'px; margin-bottom: '.$dist.'px;" />
00797 ';
00798         return $this->sectionEnd().$str;
00799     }
00800 
00801     /**
00802      * Returns a blank <div>-section with a height
00803      *
00804      * @param   integer     Padding-top for the div-section (should be margin-top but konqueror (3.1) doesn't like it :-(
00805      * @return  string      HTML content
00806      */
00807     function spacer($dist)  {
00808         if ($dist>0)    {
00809             return '
00810 
00811     <!-- Spacer element -->
00812     <div style="padding-top: '.intval($dist).'px;"></div>
00813 ';
00814         }
00815     }
00816 
00817     /**
00818      * Make a section header.
00819      * Begins a section if not already open.
00820      *
00821      * @param   string      The label between the <h3> or <h4> tags. (Allows HTML)
00822      * @param   boolean     If set, <h3> is used, otherwise <h4>
00823      * @param   string      Additional attributes to h-tag, eg. ' class=""'
00824      * @return  string      HTML content
00825      */
00826     function sectionHeader($label,$sH=FALSE,$addAttrib='')  {
00827         $tag = ($sH?'h3':'h4');
00828         $str='
00829 
00830     <!-- Section header -->
00831     <'.$tag.$addAttrib.'>'.$label.'</'.$tag.'>
00832 ';
00833         return $this->sectionBegin().$str;
00834     }
00835 
00836     /**
00837      * Begins an output section.
00838      * Returns the <div>-begin tag AND sets the ->sectionFlag true (if the ->sectionFlag is not already set!)
00839      * 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!
00840      *
00841      * @return  string      HTML content
00842      */
00843     function sectionBegin() {
00844         if (!$this->sectionFlag)    {
00845             $this->sectionFlag=1;
00846             $str='
00847 
00848     <!-- ***********************
00849           Begin output section.
00850          *********************** -->
00851     <div>
00852 ';
00853             return $str;
00854         } else return '';
00855     }
00856 
00857     /**
00858      * Ends and output section
00859      * Returns the </div>-end tag AND clears the ->sectionFlag (but does so only IF the sectionFlag is set - that is a section is 'open')
00860      * See sectionBegin() also.
00861      *
00862      * @return  string      HTML content
00863      */
00864     function sectionEnd()   {
00865         if ($this->sectionFlag) {
00866             $this->sectionFlag=0;
00867             return '
00868     </div>
00869     <!-- *********************
00870           End output section.
00871          ********************* -->
00872 ';
00873         } else return '';
00874     }
00875 
00876     /**
00877      * Originally it printed a kind of divider.
00878      * Deprecated. Just remove function calls to it or call the divider() function instead.
00879      *
00880      * @return  void
00881      * @internal
00882      * @deprecated since TYPO3 4.0
00883      */
00884     function middle()   {
00885     }
00886 
00887     /**
00888      * If a form-tag is defined in ->form then and end-tag for that <form> element is outputted
00889      * Further a JavaScript section is outputted which will update the top.busy session-expiry object (unless $this->endJS is set to false)
00890      *
00891      * @return  string      HTML content (<script> tag section)
00892      */
00893     function endPageJS()    {
00894         return ($this->endJS?'
00895     <script type="text/javascript">
00896           /*<![CDATA[*/
00897         if (top.busy && top.busy.loginRefreshed) {
00898             top.busy.loginRefreshed();
00899         }
00900          /*]]>*/
00901     </script>':'');
00902     }
00903 
00904     /**
00905      * Creates the bodyTag.
00906      * You can add to the bodyTag by $this->bodyTagAdditions
00907      *
00908      * @return  string      HTML body tag
00909      */
00910     function docBodyTagBegin()  {
00911         $bodyContent = 'body onclick="if (top.menuReset) top.menuReset();" '.trim($this->bodyTagAdditions.($this->bodyTagId ? ' id="'.$this->bodyTagId.'"' : ''));
00912         return '<'.trim($bodyContent).'>';
00913     }
00914 
00915     /**
00916      * Outputting document style
00917      *
00918      * @return  string      HTML style section/link tags
00919      */
00920     function docStyle() {
00921 
00922             // Request background image:
00923         if ($this->backGroundImage) {
00924             $this->inDocStylesArray[]=' BODY { background-image: url('.$this->backPath.$this->backGroundImage.'); }';
00925         }
00926 
00927             // Add inDoc styles variables as well:
00928         $this->inDocStylesArray[] = $this->inDocStyles;
00929         $this->inDocStylesArray[] = $this->inDocStyles_TBEstyle;
00930 
00931             // Implode it all:
00932         $inDocStyles = implode('
00933                     ',$this->inDocStylesArray);
00934 
00935             // The default color scheme should also in full be represented in the stylesheet.
00936         $style=trim('
00937             '.($this->styleSheetFile?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile.'" />':'').'
00938             '.($this->styleSheetFile2?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile2.'" />':'').'
00939             <style type="text/css" id="internalStyle">
00940                 /*<![CDATA[*/
00941                     '.trim($inDocStyles).'
00942                     /*###POSTCSSMARKER###*/
00943                 /*]]>*/
00944             </style>
00945             '.($this->styleSheetFile_post?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile_post.'" />':'').'
00946             '.implode("\n", $this->additionalStyleSheets)
00947         )
00948         ;
00949         $this->inDocStyles='';
00950         $this->inDocStylesArray=array();
00951 
00952         return '
00953             '.$style;
00954     }
00955 
00956     /**
00957      * Insert additional style sheet link
00958      *
00959      * @param   string      $key: some key identifying the style sheet
00960      * @param   string      $href: uri to the style sheet file
00961      * @param   string      $title: value for the title attribute of the link element
00962      * @return  string      $relation: value for the rel attribute of the link element
00963      * @return  void
00964      */
00965     function addStyleSheet($key, $href, $title='', $relation='stylesheet') {
00966         if (!isset($this->additionalStyleSheets[$key])) {
00967             $this->additionalStyleSheets[$key] = '<link rel="' . $relation . '" type="text/css" href="' . $href . '"' . ($title ? (' title="' . $title . '"') : '') . ' />';
00968         }
00969      }
00970 
00971     /**
00972      * Insert post rendering document style into already rendered content
00973      * This is needed for extobjbase
00974      *
00975      * @param   string      style-content to insert.
00976      * @return  string      content with inserted styles
00977      */
00978     function insertStylesAndJS($content)    {
00979             // insert accumulated CSS
00980         $this->inDocStylesArray[] = $this->inDocStyles;
00981         $styles = "\n".implode("\n", $this->inDocStylesArray);
00982         $content = str_replace('/*###POSTCSSMARKER###*/',$styles,$content);
00983 
00984             // insert accumulated JS
00985         $jscode = $this->JScode."\n".$this->wrapScriptTags(implode("\n", $this->JScodeArray));
00986         $content = str_replace('<!--###POSTJSMARKER###-->',$jscode,$content);
00987 
00988         return $content;
00989     }
00990 
00991     /**
00992      * Initialize the charset.
00993      * Sets the internal $this->charset variable to the charset defined in $GLOBALS["LANG"] (or the default as set in this class)
00994      * Returns the meta-tag for the document header
00995      *
00996      * @return  string      <meta> tag with charset from $this->charset or $GLOBALS['LANG']->charSet
00997      */
00998     function initCharset()  {
00999             // Set charset to the charset provided by the current backend users language selection:
01000         $this->charset = $GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : $this->charset;
01001             // Return meta tag:
01002         return '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset.'" />';
01003     }
01004 
01005     /**
01006      * Returns generator meta tag
01007      *
01008      * @return  string      <meta> tag with name "generator"
01009      */
01010     function generator()    {
01011         $str = 'TYPO3 '.TYPO3_branch.', http://typo3.com, &#169; Kasper Sk&#229;rh&#248;j 1998-2008, extensions are copyright of their respective owners.';
01012         return '<meta name="generator" content="'.$str .'" />';
01013     }
01014 
01015 
01016 
01017 
01018 
01019 
01020 
01021 
01022     /*****************************************
01023      *
01024      * OTHER ELEMENTS
01025      * Tables, buttons, formatting dimmed/red strings
01026      *
01027      ******************************************/
01028 
01029 
01030     /**
01031      * Returns an image-tag with an 18x16 icon of the following types:
01032      *
01033      * $type:
01034      * -1:  OK icon (Check-mark)
01035      * 1:   Notice (Speach-bubble)
01036      * 2:   Warning (Yellow triangle)
01037      * 3:   Fatal error (Red stop sign)
01038      *
01039      * @param   integer     See description
01040      * @param   string      Value for style attribute
01041      * @return  string      HTML image tag (if applicable)
01042      */
01043     function icons($type, $styleAttribValue='') {
01044         switch($type)   {
01045             case '3':
01046                 $icon = 'gfx/icon_fatalerror.gif';
01047             break;
01048             case '2':
01049                 $icon = 'gfx/icon_warning.gif';
01050             break;
01051             case '1':
01052                 $icon = 'gfx/icon_note.gif';
01053             break;
01054             case '-1':
01055                 $icon = 'gfx/icon_ok.gif';
01056             break;
01057             default:
01058             break;
01059         }
01060         if ($icon)  {
01061             return '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' class="absmiddle"'.($styleAttribValue ? ' style="'.htmlspecialchars($styleAttribValue).'"' : '').' alt="" />';
01062         }
01063     }
01064 
01065     /**
01066      * Returns an <input> button with the $onClick action and $label
01067      *
01068      * @param   string      The value of the onclick attribute of the input tag (submit type)
01069      * @param   string      The label for the button (which will be htmlspecialchar'ed)
01070      * @return  string      A <input> tag of the type "submit"
01071      */
01072     function t3Button($onClick,$label)  {
01073         $button = '<input type="submit" onclick="'.htmlspecialchars($onClick).'; return false;" value="'.htmlspecialchars($label).'" />';
01074         return $button;
01075     }
01076 
01077     /**
01078      * dimmed-fontwrap. Returns the string wrapped in a <span>-tag defining the color to be gray/dimmed
01079      *
01080      * @param   string      Input string
01081      * @return  string      Output string
01082      */
01083     function dfw($string)   {
01084         return '<span class="typo3-dimmed">'.$string.'</span>';
01085     }
01086 
01087