*/ /** * [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 since TYPO3 3.6 */ 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. ':''); } /** * 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?'':'').' '.implode("\n", $this->additionalStyleSheets) ) ; $this->inDocStyles=''; $this->inDocStylesArray=array(); return ' '.$style; } /** * Insert additional style sheet link * * @param string $key: some key identifying the style sheet * @param string $href: uri to the style sheet file * @param string $title: value for the title attribute of the link element * @return string $relation: value for the rel attribute of the link element * @return void */ function addStyleSheet($key, $href, $title='', $relation='stylesheet') { if (!isset($this->additionalStyleSheets[$key])) { $this->additionalStyleSheets[$key] = ''; } } /** * 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-2008, 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 $data * * @param array Multidim array with first levels = rows, second levels = cells * @param array If set, then this provides an alternative layout array instead of $this->tableLayout * @return string The HTML table. * @internal */ function table($data, $layout = '') { $result = ''; if (is_array($data)) { $tableLayout = (is_array($layout) ? $layout : $this->tableLayout); $rowCount = 0; foreach ($data as $tableRow) { if ($rowCount % 2) { $layout = is_array($tableLayout['defRowOdd']) ? $tableLayout['defRowOdd'] : $tableLayout['defRow']; } else { $layout = is_array($tableLayout['defRowEven']) ? $tableLayout['defRowEven'] : $tableLayout['defRow']; } $rowLayout = is_array($tableLayout[$rowCount]) ? $tableLayout[$rowCount] : $layout; $rowResult = ''; if (is_array($tableRow)) { $cellCount = 0; foreach ($tableRow as $tableCell) { $cellWrap = (is_array($layout[$cellCount]) ? $layout[$cellCount] : $layout['defCol']); $cellWrap = (is_array($rowLayout['defCol']) ? $rowLayout['defCol'] : $cellWrap); $cellWrap = (is_array($rowLayout[$cellCount]) ? $rowLayout[$cellCount] : $cellWrap); $rowResult .= $cellWrap[0] . $tableCell . $cellWrap[1]; $cellCount++; } } $rowWrap = (is_array($layout['tr']) ? $layout['tr'] : array($this->table_TR, '')); $rowWrap = (is_array($rowLayout['tr']) ? $rowLayout['tr'] : $rowWrap); $result .= $rowWrap[0] . $rowResult . $rowWrap[1]; $rowCount++; } $tableWrap = is_array($tableLayout['table']) ? $tableLayout['table'] : array($this->table_TABLE, '
'); $result = $tableWrap[0] . $result . $tableWrap[1]; } return $result; } /** * Constructs a table with content from the $arr1, $arr2 and $arr3. * Used in eg. ext/belog/mod/index.php - refer to that for examples * * @param array Menu elements on first level * @param array Secondary items * @param array Third-level items * @return string HTML content, ...
*/ function menuTable($arr1,$arr2=array(), $arr3=array()) { $rows = max(array(count($arr1),count($arr2),count($arr3))); $menu=' '; for($a=0;$a<$rows;$a++) { $menu.=''; $cls=array(); $valign='middle'; $cls[]=''; if (count($arr2)) { $cls[]=''; if (count($arr3)) { $cls[]=''; } } $menu.=implode($cls,''); $menu.=''; } $menu.='
'.$arr1[$a][0].''.$arr1[$a][1].''.$arr2[$a][0].''.$arr2[$a][1].''.$arr3[$a][0].''.$arr3[$a][1].'  
'; return $menu; } /** * Returns a one-row/two-celled table with $content and $menu side by side. * The table is a 100% width table and each cell is aligned left / right * * @param string Content cell content (left) * @param string Menu cell content (right) * @return string HTML output */ function funcMenu($content,$menu) { return '
'.$content.' '.$menu.'
'; } /** * Creates a selector box with clear-cache items. * Rather specialized functions - at least don't use it with $addSaveOptions unless you know what you do... * * @param integer The page uid of the "current page" - the one that will be cleared as "clear cache for this page". * @param boolean If $addSaveOptions is set, then also the array of save-options for TCE_FORMS will appear. * @return string '.implode('',$opt).''; if (count($opt)>1) { return $af_content; } } /** * Includes a javascript library that exists in the core /typo3/ directory. The * backpath is automatically applied * * @param string $lib: Library name. Call it with the full path * like "contrib/prototype/prototype.js" to load it * @return void */ function loadJavascriptLib($lib) { if (!isset($this->JScodeLibArray[$lib])) { $this->JScodeLibArray[$lib] = ''; } } /** * * @param string $lib it will remove lib from general JScodeLibArray because lib is loaded already. */ protected function removeJavascriptLib($lib) { if (count($this->JScodeLibArray)) { $scripts = array_keys($this->JScodeLibArray); foreach ($scripts as $script) { if (strpos($script, '/' . $lib . '/') !== false) { unset ($this->JScodeLibArray[$script]); } } } } /** * 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->loadPrototype(); $this->loadJavascriptLib('js/clickmenu.js'); $this->JScodeArray['clickmenu'] = ' Clickmenu.clickURL = "'.$this->backPath.'alt_clickmenu.php"; Clickmenu.ajax = '.($this->isCMLayers() ? 'true' : 'false' ).';'; // return array deprecated since 4.2 return array('','',''); } /** * Includes the necessary javascript file (tree.js) for use on pages which have the * drag and drop functionality (usually pages and folder display trees) * * @param string indicator of which table the drag and drop function should work on (pages or folders) * @return array If values are present: [0] = A '; } } return $content; } /** * Creates the id for dynTabMenus. * * @param string $identString: Identification string. This should be unique for every instance of a dynamic menu! * @return string The id with a short MD5 of $identString and prefixed "DTM-", like "DTM-2e8791854a" */ function getDynTabMenuId($identString) { $id = 'DTM-'.t3lib_div::shortMD5($identString); return $id; } /** * Returns dynamic tab menu header JS code. * This is now incorporated automatically when the function template::getDynTabMenu is called * (as long as it is called before $this->startPage()) * The return value is not needed anymore * * @return string JavaScript section for the HTML header. (return value is deprecated since TYPO3 4.3, will be removed in TYPO3 4.5) */ function getDynTabMenuJScode() { $this->loadJavascriptLib('js/tabmenu.js'); // return value deprecated since TYPO3 4.3 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).'"
'; } } } } } /** * Function to load a HTML template file with markers. * * @param string tmpl name, usually in the typo3/template/ directory * @return string HTML of template */ function getHtmlTemplate($filename) { if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) { $filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]; } return ($filename ? t3lib_div::getURL(t3lib_div::resolveBackPath($this->backPath . $filename)) : ''); } /** * Define the template for the module * * @param string filename */ function setModuleTemplate($filename) { // Load Prototype lib for IE event $this->loadPrototype(); $this->loadJavascriptLib('js/iecompatibility.js'); $this->moduleTemplate = $this->getHtmlTemplate($filename); } /** * Put together the various elements for the module using a static HTML * template * * @param array Record of the current page, used for page path and info * @param array HTML for all buttons * @param array HTML for all other markers * @return string Composite HTML */ public function moduleBody($pageRecord = array(), $buttons = array(), $markerArray = array(), $subpartArray = array()) { // Get the HTML template for the module $moduleBody = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###FULLDOC###'); // Add CSS $this->inDocStylesArray[] = 'html { overflow: hidden; }'; // Add JS code to the for IE $this->JScode.= $this->wrapScriptTags(' // workaround since IE6 cannot deal with relative height for scrolling elements function resizeDocBody() { $("typo3-docbody").style.height = (document.body.offsetHeight - parseInt($("typo3-docheader").getStyle("height"))); } if (Prototype.Browser.IE) { var version = parseFloat(navigator.appVersion.split(\';\')[1].strip().split(\' \')[1]); if (version == 6) { Event.observe(window, "resize", resizeDocBody, false); Event.observe(window, "load", resizeDocBody, false); } } '); // Get the page path for the docheader $markerArray['PAGEPATH'] = $this->getPagePath($pageRecord); // Get the page info for the docheader $markerArray['PAGEINFO'] = $this->getPageInfo($pageRecord); // Get all the buttons for the docheader $docHeaderButtons = $this->getDocHeaderButtons($buttons); // Merge docheader buttons with the marker array $markerArray = array_merge($markerArray, $docHeaderButtons); // replacing subparts foreach ($subpartArray as $marker => $content) { $moduleBody = t3lib_parsehtml::substituteSubpart($moduleBody, $marker, $content); } // replacing all markers with the finished markers and return the HTML content return t3lib_parsehtml::substituteMarkerArray($moduleBody, $markerArray, '###|###'); } /** * Fill the button lists with the defined HTML * * @param array HTML for all buttons * @return array Containing HTML for both buttonlists */ protected function getDocHeaderButtons($buttons) { $markers = array(); // Fill buttons for left and right float $floats = array('left', 'right'); foreach($floats as $key) { // Get the template for each float $buttonTemplate = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###BUTTON_GROUPS_' . strtoupper($key) . '###'); // Fill the button markers in this float $buttonTemplate = t3lib_parsehtml::substituteMarkerArray($buttonTemplate, $buttons, '###|###', true); // getting the wrap for each group $buttonWrap = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###BUTTON_GROUP_WRAP###'); // looping through the groups (max 6) and remove the empty groups for ($groupNumber = 1; $groupNumber < 6; $groupNumber++) { $buttonMarker = '###BUTTON_GROUP' . $groupNumber . '###'; $buttonGroup = t3lib_parsehtml::getSubpart($buttonTemplate, $buttonMarker); if (trim($buttonGroup)) { if ($buttonWrap) { $buttonGroup = t3lib_parsehtml::substituteMarker($buttonWrap, '###BUTTONS###', $buttonGroup); } $buttonTemplate = t3lib_parsehtml::substituteSubpart($buttonTemplate, $buttonMarker, trim($buttonGroup)); } } // replace the marker with the template and remove all line breaks (for IE compat) $markers['BUTTONLIST_' . strtoupper($key)] = str_replace("\n", '', $buttonTemplate); } return $markers; } /** * Generate the page path for docheader * * @param array Current page * @return string Page path */ protected function getPagePath($pageRecord) { global $LANG; // Is this a real page if ($pageRecord['uid']) { $title = $pageRecord['_thePath']; } else { $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting the path of the page $pagePath = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path', 1) . ': ' . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, -50)) . ''; return $pagePath; } /** * Setting page icon with clickmenu + uid for docheader * * @param array Current page * @return string Page info */ protected function getPageInfo($pageRecord) { global $BE_USER; // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages'); $iconImg = t3lib_iconWorks::getIconImage('pages', $pageRecord, $this->backPath, 'class="absmiddle" title="'. htmlspecialchars($alttext) . '"'); // Make Icon: $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); } else { // On root-level of page tree // Make Icon $iconImg = 'backPath, 'gfx/i/_icon_website.gif') . ' alt="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '" />'; if($BE_USER->user['admin']) { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '[pid: ' . $pageRecord['uid'] . ']'; return $pageInfo; } /** * Following functions are help function for JS library include. * They enable loading the libraries prototype, scriptaculous and extJS from contrib-directory */ /** * Function for render the JS-libraries in header * Load order is prototype / scriptaculous / extJS */ protected function renderJSlibraries() { $libs = array(); // include prototype if ($this->addPrototype) { $libs[] = 'contrib/prototype/prototype.js'; // remove prototype from JScodeLibArray $this->removeJavascriptLib('prototype'); } // include scriptaculous if ($this->addScriptaculous) { $mods = array(); foreach ($this->addScriptaculousModules as $key => $value) { if ($this->addScriptaculousModules[$key]) { $mods[] = $key; } } // resolve dependencies if (in_array('dragdrop', $mods) || in_array('controls', $mods)) { $mods = array_merge(array('effects'), $mods); } if (count($mods)) { $moduleLoadString = '?load=' . implode(',', $mods); } $libs[] = 'contrib/scriptaculous/scriptaculous.js' . $moduleLoadString; // remove scriptaculous from JScodeLibArray $this->removeJavascriptLib('scriptaculous'); } // include extJS if ($this->addExtJS) { // if prototype is loaded, then use the prototype adapter, otherwise the default one if ($this->addPrototype) { $libs[] = 'contrib/extjs/adapter/prototype/ext-prototype-adapter.js'; } else { $libs[] = 'contrib/extjs/adapter/ext/ext-base.js'; } $libs[] = 'contrib/extjs/ext-all' . ($this->addExtJSdebug ? '-debug' : '') . '.js'; // add extJS localization $localeMap = $GLOBAL['LANG']->csConvObj->isoArray; // load standard ISO mapping and modify for use with ExtJS $localeMap[''] = 'en'; $localeMap['default'] = 'en'; $localeMap['gr'] = 'el_GR'; // Greek $localeMap['no'] = 'no_BO'; // Norwegian Bokmaal $localeMap['se'] = 'se_SV'; // Swedish $extJsLang = isset($localeMap[$GLOBALS['BE_USER']->uc['lang']]) ? $localeMap[$GLOBALS['BE_USER']->uc['lang']] : $GLOBALS['BE_USER']->uc['lang']; // TODO autoconvert file from UTF8 to current BE charset if necessary!!!! $extJsLocaleFile = 'contrib/extjs/locale/ext-lang-' . $extJsLang . '.js'; if (file_exists(PATH_typo3 . $extJsLocaleFile)) { $libs[] = $extJsLocaleFile; } // set clear.gif $this->extJScode .= 'Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(t3lib_div::locationHeaderUrl('gfx/clear.gif')) . '";'; // remove extjs from JScodeLibArray $this->removeJavascriptLib('extjs'); } foreach ($libs as &$lib) { $lib = ''; } // add other JavascriptLibs and return it $libs = array_merge($libs, $this->JScodeLibArray); return count($libs) ? chr(10) . chr(10) . implode(chr(10), $libs) . chr(10) . chr(10) : ''; } /** * call function if you need the prototype library */ public function loadPrototype() { $this->addPrototype = true; } /** * call function if you need the Scriptaculous library * @param string $modules add modules you need. use "all" if you need complete modules */ public function loadScriptaculous($modules='') { // Scriptaculous require prototype, so load prototype too. $this->addPrototype = true; $this->addScriptaculous = true; if ($modules) { if ($modules == 'all') { foreach ($this->addScriptaculousModules as $key => $value) { $this->addScriptaculousModules[$key] = true; } } else { $mods = t3lib_div::trimExplode(',', $modules); foreach ($mods as $mod) { if (isset($this->addScriptaculousModules[strtolower($mod)])) { $this->addScriptaculousModules[strtolower($mod)] = true; } } } } } /** * call this function if you need the extJS library * @param string $css */ public function loadExtJS($css = true, $theme = true) { if (!$this->addExtJS) { $this->addExtJS = true; if ($css) { if (isset($GLOBALS['TBE_STYLES']['extJS']['all'])) { $this->addStyleSheet('ext-all', $GLOBALS['TBE_STYLES']['extJS']['all']); } else { $this->addStyleSheet('ext-all', $this->backPath . 'contrib/extjs/resources/css/ext-all.css'); } } if ($theme) { if (isset($GLOBALS['TBE_STYLES']['extJS']['theme'])) { $this->addStyleSheet('ext-theme', $GLOBALS['TBE_STYLES']['extJS']['theme']); } else { $this->addStyleSheet('ext-theme', $this->backPath . 'contrib/extjs/resources/css/xtheme-gray.css'); } } } } /** * call this function to load debug version of extJS. Use this for development only */ public function setExtJSdebug() { $this->addExtJSdebug = true; } } // ****************************** // 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'; } 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 template is loaded // ****************************** $GLOBALS['TBE_TEMPLATE'] = t3lib_div::makeInstance('template'); ?>