Documentation TYPO3 par Ameos |
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 ***************************************************************/ 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 00145 function fw($str) { 00146 return $str; 00147 } 00148 00149 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 $JScode=''; // Additional header code (eg. a JavaScript section) could be accommulated in this var. It will be directly outputted in the header. 00175 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. 00176 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. 00177 var $docType = ''; // Doc-type used in the header. Default is HTML 4. You can also set it to 'strict', 'xhtml_trans', or 'xhtml_frames'. 00178 00179 // Other vars you can change, but less frequently used: 00180 var $scriptID=''; // Script ID. 00181 var $bodyTagId=''; // Id which can be set for the body tag. Default value is based on script ID 00182 var $bodyTagAdditions=''; // You can add additional attributes to the body-tag through this variable. 00183 var $inDocStyles=''; // Additional CSS styles which will be added to the <style> section in the header 00184 var $inDocStylesArray=array(); // Like $inDocStyles but for use as array with associative keys to prevent double inclusion of css code 00185 var $form_rowsToStylewidth = 9.58; // Multiplication factor for formWidth() input size (default is 48* this value). 00186 var $form_largeComp = 1.33; // Compensation for large documents (used in class.t3lib_tceforms.php) 00187 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. 00188 00189 // TYPO3 Colorscheme. 00190 // If you want to change this, please do so through a skin using the global var $TBE_STYLES 00191 var $bgColor = '#F7F3EF'; // Light background color 00192 var $bgColor2 = '#9BA1A8'; // Steel-blue 00193 var $bgColor3 = '#F6F2E6'; // dok.color 00194 var $bgColor4 = '#D9D5C9'; // light tablerow background, brownish 00195 var $bgColor5 = '#ABBBB4'; // light tablerow background, greenish 00196 var $bgColor6 = '#E7DBA8'; // light tablerow background, yellowish, for section headers. Light. 00197 var $hoverColor = '#254D7B'; 00198 var $styleSheetFile = 'stylesheet.css'; // Filename of stylesheet (relative to PATH_typo3) 00199 var $styleSheetFile2 = ''; // Filename of stylesheet #2 - linked to right after the $this->styleSheetFile script (relative to PATH_typo3) 00200 var $styleSheetFile_post = ''; // Filename of a post-stylesheet - included right after all inline styles. 00201 var $backGroundImage = ''; // Background image of page (relative to PATH_typo3) 00202 var $inDocStyles_TBEstyle = ''; // Inline css styling set from TBE_STYLES array 00203 00204 // DEV: 00205 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. 00206 00207 // INTERNAL 00208 var $charset = 'iso-8859-1'; // Default charset. see function initCharset() 00209 00210 var $sectionFlag=0; // Internal: Indicates if a <div>-output section is open 00211 var $divClass = ''; // (Default) Class for wrapping <DIV>-tag of page. Is set in class extensions. 00212 00213 00214 00215 00216 00217 00224 function template() { 00225 global $TBE_STYLES; 00226 00227 // Setting default scriptID: 00228 $this->scriptID = ereg_replace('^.*\/(sysext|ext)\/','ext/',substr(PATH_thisScript,strlen(PATH_site))); 00229 if (TYPO3_mainDir!='typo3/' && substr($this->scriptID,0,strlen(TYPO3_mainDir)) == TYPO3_mainDir) { 00230 $this->scriptID = 'typo3/'.substr($this->scriptID,strlen(TYPO3_mainDir)); // This fixes if TYPO3_mainDir has been changed so the script ids are STILL "typo3/..." 00231 } 00232 00233 $this->bodyTagId = ereg_replace('[^[:alnum:]-]','-',$this->scriptID); 00234 00235 // Individual configuration per script? If so, make a recursive merge of the arrays: 00236 if (is_array($TBE_STYLES['scriptIDindex'][$this->scriptID])) { 00237 $ovr = $TBE_STYLES['scriptIDindex'][$this->scriptID]; // Make copy 00238 $TBE_STYLES = t3lib_div::array_merge_recursive_overrule($TBE_STYLES,$ovr); // merge styles. 00239 unset($TBE_STYLES['scriptIDindex'][$this->scriptID]); // Have to unset - otherwise the second instantiation will do it again! 00240 } 00241 00242 // Color scheme: 00243 if ($TBE_STYLES['mainColors']['bgColor']) $this->bgColor=$TBE_STYLES['mainColors']['bgColor']; 00244 if ($TBE_STYLES['mainColors']['bgColor1']) $this->bgColor1=$TBE_STYLES['mainColors']['bgColor1']; 00245 if ($TBE_STYLES['mainColors']['bgColor2']) $this->bgColor2=$TBE_STYLES['mainColors']['bgColor2']; 00246 if ($TBE_STYLES['mainColors']['bgColor3']) $this->bgColor3=$TBE_STYLES['mainColors']['bgColor3']; 00247 if ($TBE_STYLES['mainColors']['bgColor4']) $this->bgColor4=$TBE_STYLES['mainColors']['bgColor4']; 00248 if ($TBE_STYLES['mainColors']['bgColor5']) $this->bgColor5=$TBE_STYLES['mainColors']['bgColor5']; 00249 if ($TBE_STYLES['mainColors']['bgColor6']) $this->bgColor6=$TBE_STYLES['mainColors']['bgColor6']; 00250 if ($TBE_STYLES['mainColors']['hoverColor']) $this->hoverColor=$TBE_STYLES['mainColors']['hoverColor']; 00251 00252 // Main Stylesheets: 00253 if ($TBE_STYLES['stylesheet']) $this->styleSheetFile = $TBE_STYLES['stylesheet']; 00254 if ($TBE_STYLES['stylesheet2']) $this->styleSheetFile2 = $TBE_STYLES['stylesheet2']; 00255 if ($TBE_STYLES['styleSheetFile_post']) $this->styleSheetFile_post = $TBE_STYLES['styleSheetFile_post']; 00256 if ($TBE_STYLES['inDocStyles_TBEstyle']) $this->inDocStyles_TBEstyle = $TBE_STYLES['inDocStyles_TBEstyle']; 00257 00258 // Background image 00259 if ($TBE_STYLES['background']) $this->backGroundImage = $TBE_STYLES['background']; 00260 } 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 /***************************************** 00278 * 00279 * EVALUATION FUNCTIONS 00280 * Various centralized processing 00281 * 00282 *****************************************/ 00283 00298 function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE) { 00299 $backPath = rawurlencode($this->backPath).'|'.t3lib_div::shortMD5($this->backPath.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']); 00300 $onClick = 'showClickmenu("'.$table.'","'.$uid.'","'.$listFr.'","'.str_replace('+','%2B',$enDisItems).'","'.str_replace('&','&',addcslashes($backPath,'"')).'","'.str_replace('&','&',addcslashes($addParams,'"')).'");return false;'; 00301 return $returnOnClick ? $onClick : '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'] ? ' oncontextmenu="'.htmlspecialchars($onClick).'"' : '').'>'.$str.'</a>'; 00302 } 00303 00315 function viewPageIcon($id,$backPath,$addParams='hspace="3"') { 00316 global $BE_USER; 00317 $str = ''; 00318 // If access to Web>List for user, then link to that module. 00319 if ($BE_USER->check('modules','web_list')) { 00320 $href=$backPath.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')); 00321 $str.= '<a href="'.htmlspecialchars($href).'">'. 00322 '<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="" />'. 00323 '</a>'; 00324 } 00325 // Make link to view page 00326 $str.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($id,$backPath,t3lib_BEfunc::BEgetRootLine($id))).'">'. 00327 '<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="" />'. 00328 '</a>'; 00329 return $str; 00330 } 00331 00341 function issueCommand($params,$rUrl='') { 00342 $rUrl = $rUrl ? $rUrl : t3lib_div::getIndpEnv('REQUEST_URI'); 00343 return $this->backPath.'tce_db.php?'. 00344 $params. 00345 '&redirect='.($rUrl==-1?"'+T3_THIS_LOCATION+'":rawurlencode($rUrl)). 00346 '&vC='.rawurlencode($GLOBALS['BE_USER']->veriCode()). 00347 '&prErr=1&uPT=1'; 00348 } 00349 00356 function isCMlayers() { 00357 return !$GLOBALS['BE_USER']->uc['disableCMlayers'] && $GLOBALS['CLIENT']['FORMSTYLE'] && !($GLOBALS['CLIENT']['SYSTEM']=='mac' && $GLOBALS['CLIENT']['BROWSER']=='Opera'); 00358 } 00359 00366 function thisBlur() { 00367 return ($GLOBALS['CLIENT']['FORMSTYLE']?'this.blur();':''); 00368 } 00369 00376 function helpStyle() { 00377 return $GLOBALS['CLIENT']['FORMSTYLE'] ? ' style="cursor:help;"':''; 00378 } 00379 00393 function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('','')) { 00394 global $TCA; 00395 if (is_array($row) && $row['uid']) { 00396 $iconImgTag=t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($path).'"'); 00397 $title= strip_tags($row[$TCA[$table]['ctrl']['label']]); 00398 $viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'],$this->backPath,''); 00399 if ($table=='pages') $path.=' - '.t3lib_BEfunc::titleAttribForPages($row,'',0); 00400 } else { 00401 $iconImgTag='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif',$wHattribs='width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />'; 00402 $title=$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; 00403 } 00404 00405 return '<span class="typo3-moduleHeader">'.$this->wrapClickMenuOnIcon($iconImgTag,$table,$row['uid']). 00406 $viewPage. 00407 $tWrap[0].htmlspecialchars(t3lib_div::fixed_lgd_cs($title,45)).$tWrap[1].'</span>'; 00408 } 00409 00419 function getFileheader($title,$path,$iconfile) { 00420 $fileInfo = t3lib_div::split_fileref($title); 00421 $title = htmlspecialchars(t3lib_div::fixed_lgd_cs($fileInfo['path'],-35)).'<b>'.htmlspecialchars($fileInfo['file']).'</b>'; 00422 return '<span class="typo3-moduleHeader"><img'.t3lib_iconWorks::skinImg($this->backPath,$iconfile,'width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />'.$title.'</span>'; 00423 } 00424 00434 function makeShortcutIcon($gvList,$setList,$modName,$motherModName="") { 00435 $backPath=$this->backPath; 00436 $storeUrl=$this->makeShortcutUrl($gvList,$setList); 00437 $pathInfo = parse_url(t3lib_div::getIndpEnv('REQUEST_URI')); 00438 00439 if (!strcmp($motherModName,'1')) { 00440 $mMN="&motherModName='+top.currentModuleLoaded+'"; 00441 } elseif ($motherModName) { 00442 $mMN='&motherModName='.rawurlencode($motherModName); 00443 } else $mMN=''; 00444 00445 $onClick = 'if (top.shortcutFrame && confirm('. 00446 $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut')). 00447 ')){top.shortcutFrame.location.href=\''.$backPath.'alt_shortcut.php?modName='.rawurlencode($modName). 00448 '&URL='.rawurlencode($pathInfo['path']."?".$storeUrl). 00449 $mMN. 00450 '\';}return false;'; 00451 00452 $sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'"> 00453 <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>'; 00454 return $sIcon; 00455 } 00456 00467 function makeShortcutUrl($gvList,$setList) { 00468 $GET = t3lib_div::_GET(); 00469 $storeArray = array_merge( 00470 t3lib_div::compileSelectedGetVarsFromArray($gvList,$GET), 00471 array('SET'=>t3lib_div::compileSelectedGetVarsFromArray($setList,$GLOBALS['SOBE']->MOD_SETTINGS)) 00472 ); 00473 $storeUrl = t3lib_div::implodeArrayForUrl('',$storeArray); 00474 return $storeUrl; 00475 } 00476 00488 function formWidth($size=48,$textarea=0,$styleOverride='') { 00489 $wAttrib = $textarea?'cols':'size'; 00490 if (!$GLOBALS['CLIENT']['FORMSTYLE']) { // If not setting the width by style-attribute 00491 $size = $size; 00492 $retVal = ' '.$wAttrib.'="'.$size.'"'; 00493 } else { // Setting width by style-attribute. 'cols' MUST be avoided with NN6+ 00494 $pixels = ceil($size*$this->form_rowsToStylewidth); 00495 $retVal = $styleOverride ? ' style="'.$styleOverride.'"' : ' style="width:'.$pixels.'px;"'; 00496 } 00497 return $retVal; 00498 } 00499 00513 function formWidthText($size=48,$styleOverride='',$wrap='') { 00514 $wTags = $this->formWidth($size,1,$styleOverride); 00515 // 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... 00516 if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) { 00517 $wTags.=' cols="'.$size.'"'; 00518 } 00519 return $wTags; 00520 } 00521 00530 function redirectUrls($thisLocation='') { 00531 $thisLocation = $thisLocation?$thisLocation:t3lib_div::linkThisScript( 00532 array( 00533 'CB'=>'', 00534 'SET'=>'', 00535 'cmd' => '', 00536 'popViewId'=>'' 00537 )); 00538 00539 $out =" 00540 var T3_RETURN_URL = '".str_replace('%20','',rawurlencode(t3lib_div::_GP('returnUrl')))."'; 00541 var T3_THIS_LOCATION = '".str_replace('%20','',rawurlencode($thisLocation))."'; 00542 "; 00543 return $out; 00544 } 00545 00554 function formatTime($tstamp,$type) { 00555 $dateStr = ''; 00556 switch($type) { 00557 case 1: $dateStr = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$tstamp); 00558 break; 00559 case 10: $dateStr = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp); 00560 break; 00561 } 00562 return $dateStr; 00563 } 00564 00571 function parseTime() { 00572 if ($this->parseTimeFlag && $GLOBALS['BE_USER']->isAdmin()) { 00573 return '<p>(ParseTime: '.(t3lib_div::milliseconds()-$GLOBALS['PARSETIME_START']).' ms</p> 00574 <p>REQUEST_URI-length: '.strlen(t3lib_div::getIndpEnv('REQUEST_URI')).')</p>'; 00575 } 00576 } 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 /***************************************** 00590 * 00591 * PAGE BUILDING FUNCTIONS. 00592 * Use this to build the HTML of your backend modules 00593 * 00594 *****************************************/ 00595 00604 function startPage($title) { 00605 // Get META tag containing the currently selected charset for backend output. The function sets $this->charSet. 00606 $charSet = $this->initCharset(); 00607 $generator = $this->generator(); 00608 00609 // For debugging: If this outputs "QuirksMode"/"BackCompat" (IE) the browser runs in quirks-mode. Otherwise the value is "CSS1Compat" 00610 # $this->JScodeArray[]='alert(document.compatMode);'; 00611 00612 // Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003 00613 header ('Content-Type:text/html;charset='.$this->charset); 00614 00615 switch($this->docType) { 00616 case 'xhtml_strict': 00617 $headerStart= '<!DOCTYPE html 00618 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 00619 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 00620 <?xml version="1.0" encoding="'.$this->charset.'"?> 00621 <?xml-stylesheet href="#internalStyle" type="text/css"?> 00622 '; 00623 break; 00624 case 'xhtml_trans': 00625 $headerStart= '<!DOCTYPE html 00626 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 00627 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 00628 <?xml version="1.0" encoding="'.$this->charset.'"?> 00629 <?xml-stylesheet href="#internalStyle" type="text/css"?> 00630 '; 00631 break; 00632 case 'xhtml_frames': 00633 $headerStart= '<!DOCTYPE html 00634 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 00635 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> 00636 <?xml version="1.0" encoding="'.$this->charset.'"?> 00637 '; 00638 break; 00639 default: 00640 $headerStart='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'; 00641 break; 00642 } 00643 00644 $tabJScode = ''; 00645 if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) { 00646 // This loads the tabulator-in-textarea feature. It automatically modifies every textarea which is found. 00647 $tabJScode = '<script src="'.$this->backPath.'tab.js" type="text/javascript"></script>'; 00648 } 00649 00650 // Construct page header. 00651 $str = $headerStart.' 00652 <html> 00653 <head> 00654 <!-- TYPO3 Script ID: '.htmlspecialchars($this->scriptID).' --> 00655 '.$charSet.' 00656 '.$generator.' 00657 <title>'.htmlspecialchars($title).'</title> 00658 '.$this->docStyle().' 00659 '.$this->JScode.' 00660 '.$tabJScode.' 00661 '.$this->wrapScriptTags(implode("\n", $this->JScodeArray)).' 00662 <!--###POSTJSMARKER###--> 00663 </head> 00664 '; 00665 $this->JScode=''; 00666 $this->JScodeArray=array(); 00667 00668 if ($this->docType=='xhtml_frames') { 00669 return $str; 00670 } else 00671 $str.=$this->docBodyTagBegin(). 00672 ($this->divClass?' 00673 00674 <!-- Wrapping DIV-section for whole page BEGIN --> 00675 <div class="'.$this->divClass.'"> 00676 ':'').trim($this->form); 00677 return $str; 00678 } 00679 00686 function endPage() { 00687 $str = $this->sectionEnd(). 00688 $this->postCode. 00689 $this->endPageJS(). 00690 t3lib_BEfunc::getSetUpdateSignal(). 00691 $this->parseTime(). 00692 ($this->form?' 00693 </form>':''); 00694 00695 if ($this->docType!='xhtml_frames') { 00696 00697 $str .= ($this->divClass?' 00698 00699 <!-- Wrapping DIV-section for whole page END --> 00700 </div>':'').' 00701 </body> '; 00702 00703 } 00704 00705 $str .= '</html>'; 00706 00707 // Logging: Can't find better place to put it: 00708 if (TYPO3_DLOG) t3lib_div::devLog('END of BACKEND session','',0,array('_FLUSH'=>TRUE)); 00709 00710 return $str; 00711 } 00712 00720 function header($text) { 00721 $str=' 00722 00723 <!-- MAIN Header in page top --> 00724 <h2>'.htmlspecialchars($text).'</h2> 00725 '; 00726 return $this->sectionEnd().$str; 00727 } 00728 00741 function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE) { 00742 $str=''; 00743 00744 // Setting header 00745 if ($label) { 00746 if (!$allowHTMLinHeader) $label = htmlspecialchars($label); 00747 $str.=$this->sectionHeader($this->icons($type).$label, $sH, $nostrtoupper ? '' : ' class="uppercase"'); 00748 } 00749 // Setting content 00750 $str.=' 00751 00752 <!-- Section content --> 00753 '.$text; 00754 00755 return $this->sectionBegin().$str; 00756 } 00757 00765 function divider($dist) { 00766 $dist = intval($dist); 00767 $str=' 00768 00769 <!-- DIVIDER --> 00770 <hr style="margin-top: '.$dist.'px; margin-bottom: '.$dist.'px;" /> 00771 '; 00772 return $this->sectionEnd().$str; 00773 } 00774 00781 function spacer($dist) { 00782 if ($dist>0) { 00783 return ' 00784 00785 <!-- Spacer element --> 00786 <div style="padding-top: '.intval($dist).'px;"></div> 00787 '; 00788 } 00789 } 00790 00800 function sectionHeader($label,$sH=FALSE,$addAttrib='') { 00801 $tag = ($sH?'h3':'h4'); 00802 $str=' 00803 00804 <!-- Section header --> 00805 <'.$tag.$addAttrib.'>'.$label.'</'.$tag.'> 00806 '; 00807 return $this->sectionBegin().$str; 00808 } 00809 00817 function sectionBegin() { 00818 if (!$this->sectionFlag) { 00819 $this->sectionFlag=1; 00820 $str=' 00821 00822 <!-- *********************** 00823 Begin output section. 00824 *********************** --> 00825 <div> 00826 '; 00827 return $str; 00828 } else return ''; 00829 } 00830 00838 function sectionEnd() { 00839 if ($this->sectionFlag) { 00840 $this->sectionFlag=0; 00841 return ' 00842 </div> 00843 <!-- ********************* 00844 End output section. 00845 ********************* --> 00846 '; 00847 } else return ''; 00848 } 00849 00858 function middle() { 00859 } 00860 00867 function endPageJS() { 00868 return ($this->endJS?' 00869 <script type="text/javascript"> 00870 /*<![CDATA[*/ 00871 if (top.busy && top.busy.loginRefreshed) { 00872 top.busy.loginRefreshed(); 00873 } 00874 /*]]>*/ 00875 </script>':''); 00876 } 00877 00884 function docBodyTagBegin() { 00885 $bodyContent = 'body onclick="if (top.menuReset) top.menuReset();" '.trim($this->bodyTagAdditions.($this->bodyTagId ? ' id="'.$this->bodyTagId.'"' : '')); 00886 return '<'.trim($bodyContent).'>'; 00887 } 00888 00894 function docStyle() { 00895 00896 // Request background image: 00897 if ($this->backGroundImage) { 00898 $this->inDocStylesArray[]=' BODY { background-image: url('.$this->backPath.$this->backGroundImage.'); }'; 00899 } 00900 00901 // Add inDoc styles variables as well: 00902 $this->inDocStylesArray[] = $this->inDocStyles; 00903 $this->inDocStylesArray[] = $this->inDocStyles_TBEstyle; 00904 00905 // Implode it all: 00906 $inDocStyles = implode(' 00907 ',$this->inDocStylesArray); 00908 00909 // The default color scheme should also in full be represented in the stylesheet. 00910 $style=trim(' 00911 '.($this->styleSheetFile?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile.'" />':'').' 00912 '.($this->styleSheetFile2?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile2.'" />':'').' 00913 <style type="text/css" id="internalStyle"> 00914 /*<![CDATA[*/ 00915 '.trim($inDocStyles).' 00916 /*###POSTCSSMARKER###*/ 00917 /*]]>*/ 00918 </style> 00919 '.($this->styleSheetFile_post?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile_post.'" />':'') 00920 ) 00921 ; 00922 $this->inDocStyles=''; 00923 $this->inDocStylesArray=array(); 00924 00925 return ' 00926 '.$style; 00927 } 00928 00936 function insertStylesAndJS($content) { 00937 // insert accumulated CSS 00938 $this->inDocStylesArray[] = $this->inDocStyles; 00939 $styles = "\n".implode("\n", $this->inDocStylesArray); 00940 $content = str_replace('/*###POSTCSSMARKER###*/',$styles,$content); 00941 00942 // insert accumulated JS 00943 $jscode = $this->JScode."\n".$this->wrapScriptTags(implode("\n", $this->JScodeArray)); 00944 $content = str_replace('<!--###POSTJSMARKER###-->',$jscode,$content); 00945 00946 return $content; 00947 } 00948 00956 function initCharset() { 00957 // Set charset to the charset provided by the current backend users language selection: 00958 $this->charset = $GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : $this->charset; 00959 // Return meta tag: 00960 return '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset.'" />'; 00961 } 00962 00968 function generator() { 00969 $str = 'TYPO3 '.TYPO3_branch.', http://typo3.com, © Kasper Skårhøj 1998-2006, extensions are copyright of their respective owners.'; 00970 return '<meta name="generator" content="'.$str .'" />'; 00971 } 00972 00973 00974 00975 00976 00977 00978 00979 00980 /***************************************** 00981 * 00982 * OTHER ELEMENTS 00983 * Tables, buttons, formatting dimmed/red strings 00984 * 00985 ******************************************/ 00986 00987 01001 function icons($type, $styleAttribValue='') { 01002 switch($type) { 01003 case '3': 01004 $icon = 'gfx/icon_fatalerror.gif'; 01005 break; 01006 case '2': 01007 $icon = 'gfx/icon_warning.gif'; 01008 break; 01009 case '1': 01010 $icon = 'gfx/icon_note.gif'; 01011 break; 01012 case '-1': 01013 $icon = 'gfx/icon_ok.gif'; 01014 break; 01015 default: 01016 break; 01017 } 01018 if ($icon) { 01019 return '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' class="absmiddle"'.($styleAttribValue ? ' style="'.htmlspecialchars($styleAttribValue).'"' : '').' alt="" />'; 01020 } 01021 } 01022 01030 function t3Button($onClick,$label) { 01031 $button = '<input type="submit" onclick="'.htmlspecialchars($onClick).'; return false;" value="'.htmlspecialchars($label).'" />'; 01032 return $button; 01033 } 01034 01041 function dfw($string) { 01042 return '<span class="typo3-dimmed">'.$string.'</span>'; 01043 } 01044 01051 function rfw($string) { 01052 return '<span class="typo3-red">'.$string.'</span>'; 01053 } 01054 01061 function wrapInCData($string) { 01062 $string = '/*<![CDATA[*/'. 01063 $string. 01064 '/*]]>*/'; 01065 01066 return $string; 01067 } 01068 01078 function wrapScriptTags($string, $linebreak=TRUE) { 01079 if(trim($string)) { 01080 // <script wrapped in nl? 01081 $cr = $linebreak? "\n" : ''; 01082 01083 // remove nl from the beginning 01084 $string = preg_replace ('/^\n+/', '', $string); 01085 // re-ident to one tab using the first line as reference 01086 $match = array(); 01087 if(preg_match('/^(\t+)/',$string,$match)) { 01088 $string = str_replace($match[1],"\t", $string); 01089 } 01090 $string = $cr.'<script type="text/javascript"> 01091 /*<![CDATA[*/ 01092 '.$string.' 01093 /*]]>*/ 01094 </script>'.$cr; 01095 } 01096 return trim($string); 01097 } 01098 01099 // These vars defines the layout for the table produced by the table() function. 01100 // You can override these values from outside if you like. 01101 var $tableLayout = Array ( 01102 'defRow' => Array ( 01103 'defCol' => Array('<td valign="top">','</td>') 01104 ) 01105 ); 01106 var $table_TR = '<tr>'; 01107 var $table_TABLE = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-tmpltable">'; 01108 01117 function table($arr, $layout='') { 01118 if (is_array($arr)) { 01119 $tableLayout = (is_array($layout)) ? $layout : $this->tableLayout; 01120 01121 reset($arr); 01122 $code=''; 01123 $rc=0; 01124 while(list(,$val)=each($arr)) { 01125 if ($rc % 2) { 01126 $layout = is_array($tableLayout['defRowOdd']) ? $tableLayout['defRowOdd'] : $tableLayout['defRow']; 01127 } else { 01128 $layout = is_array($tableLayout['defRowEven']) ? $tableLayout['defRowEven'] : $tableLayout['defRow']; 01129 } 01130 $layoutRow = is_array($tableLayout[$rc]) ? $tableLayout[$rc] : $layout; 01131 $code_td=''; 01132 if (is_array($val)) { 01133 $cc=0; 01134 while(list(,$content)=each($val)) { 01135 $wrap= is_array($layoutRow[$cc]) ? $layoutRow[$cc] : (is_array($layoutRow['defCol']) ? $layoutRow['defCol'] : (is_array($layout[$cc]) ? $layout[$cc] : $layout['defCol'])); 01136 $code_td.=$wrap[0].$content.$wrap[1]; 01137 $cc++; 01138 } 01139 } 01140 $trWrap = is_array($layoutRow['tr']) ? $layoutRow['tr'] : (is_array($layout['tr']) ? $layout['tr'] : array($this->table_TR, '</tr>')); 01141 $code.=$trWrap[0].$code_td.$trWrap[1]; 01142 $rc++; 01143 } 01144 $tableWrap = is_array($tableLayout['table']) ? $tableLayout['table'] : array($this->table_TABLE, '</table>'); 01145 $code=$tableWrap[0].$code.$tableWrap[1]; 01146 } 01147 return $code; 01148 } 01149 01159 function menuTable($arr1,$arr2=array(), $arr3=array()) { 01160 $rows = max(array(count($arr1),count($arr2),count($arr3))); 01161 01162 $menu=' 01163 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tablemenu">'; 01164 for($a=0;$a<$rows;$a++) { 01165 $menu.='<tr>'; 01166 $cls=array(); 01167 $valign='middle'; 01168 $cls[]='<td valign="'.$valign.'">'.$arr1[$a][0].'</td><td>'.$arr1[$a][1].'</td>'; 01169 if (count($arr2)) { 01170 $cls[]='<td valign="'.$valign.'">'.$arr2[$a][0].'</td><td>'.$arr2[$a][1].'</td>'; 01171 if (count($arr3)) { 01172 $cls[]='<td valign="'.$valign.'">'.$arr3[$a][0].'</td><td>'.$arr3[$a][1].'</td>'; 01173 } 01174 } 01175 $menu.=implode($cls,'<td> </td>'); 01176 $menu.='</tr>'; 01177 } 01178 $menu.=' 01179 </table> 01180 '; 01181 return $menu; 01182 } 01183 01192 function funcMenu($content,$menu) { 01193 return ' 01194 <table border="0" cellpadding="0" cellspacing="0" width="100%" id="typo3-funcmenu"> 01195 <tr> 01196 <td valign="top" nowrap="nowrap">'.$content.'</td> 01197 <td valign="top" align="right" nowrap="nowrap">'.$menu.'</td> 01198 </tr> 01199 </table>'; 01200 } 01201 01210 function clearCacheMenu($id,$addSaveOptions=0) { 01211 global $BE_USER; 01212 $opt=array(); 01213 if ($addSaveOptions) { 01214 $opt[]='<option value="">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.menu',1).'</option>'; 01215 $opt[]='<option value="TBE_EDITOR.checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'</option>'; 01216 $opt[]='<option value="document.editform.closeDoc.value=-2; TBE_EDITOR.checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'</option>'; 01217 if ($BE_USER->uc['allSaveFunctions']) $opt[]='<option value="document.editform.closeDoc.value=-3; TBE_EDITOR.checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseAllDocs',1).'</option>'; 01218 $opt[]='<option value="document.editform.closeDoc.value=2; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'</option>'; 01219 $opt[]='<option value="document.editform.closeDoc.value=3; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeAllDocs',1).'</option>'; 01220 $opt[]='<option value=""></option>'; 01221 } 01222 $opt[]='<option value="">[ '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_clearCache',1).' ]</option>'; 01223 if ($id) $opt[]='<option value="'.$id.'">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_thisPage',1).'</option>'; 01224 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.clearCache.pages')) $opt[]='<option value="pages">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_pages',1).'</option>'; 01225 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.clearCache.all')) $opt[]='<option value="all">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all',1).'</option>'; 01226 01227 $onChange = 'if (!this.options[this.selectedIndex].value) { 01228 this.selectedIndex=0; 01229 } else if (this.options[this.selectedIndex].value.indexOf(\';\')!=-1) { 01230 eval(this.options[this.selectedIndex].value); 01231 }else{ 01232 window.location.href=\''.$this->backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'&cacheCmd=\'+this.options[this.selectedIndex].value; 01233 }'; 01234 $af_content = '<select name="cacheCmd" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>'; 01235 01236 if (count($opt)>1) { 01237 return $af_content; 01238 } 01239 } 01240 01246 function getContextMenuCode() { 01247 $content = ' 01248 <script type="text/javascript"> 01249 /*<![CDATA[*/ 01250 // is called from most clickmenu links 01251 function showClickmenu(table, uid, listFr, enDisItems, backPath, addParams) { 01252 var url = "'.$this->backPath.'alt_clickmenu.php?table=" + encodeURIComponent(table) 01253 + "&uid=" + uid 01254 + "&listFr=" + listFr 01255 + "&enDisItems=" + enDisItems 01256 + "&backPath=" + backPath 01257 + "&addParams=" + addParams; 01258 01259 showClickmenu_raw(url); 01260 } 01261 // switch - either forwards call to ajax or does the request in the top frame 01262 function showClickmenu_raw(url) {'; 01263 if ($this->isCMlayers()) { // AJAX 01264 $content.= ' 01265 url += "&ajax=1"; 01266 ajax_doRequest(url);'; 01267 } else { // no AJAX 01268 $content.= ' 01269 showClickmenu_noajax(url);'; 01270 } 01271 $content.= ' 01272 } 01273 01274 function showClickmenu_noajax(url) { 01275 top.loadTopMenu(url); 01276 }'; 01277 if ($this->isCMlayers()) { 01278 $content.= t3lib_ajax::getJScode('showClickmenu_ajax', 'showClickmenu_noajax'); 01279 $content.=' 01280 // opens the clickmenu, is called from ajax_doRequest 01281 function showClickmenu_ajax(t3ajax) { 01282 if (t3ajax.getElementsByTagName("data")[0]) { 01283 var clickmenu = t3ajax.getElementsByTagName("data")[0].getElementsByTagName("clickmenu")[0]; 01284 var tableData = clickmenu.getElementsByTagName("htmltable")[0].firstChild.data; 01285 var cmlevel = clickmenu.getElementsByTagName("cmlevel")[0].firstChild.data; 01286 setLayerObj(tableData,cmlevel); 01287 } 01288 } 01289 01290 var GLV_gap=10; 01291 var GLV_curLayerX=new Array(0,0); 01292 var GLV_curLayerY=new Array(0,0); 01293 var GLV_curLayerWidth=new Array(0,0); 01294 var GLV_curLayerHeight=new Array(0,0); 01295 var GLV_isVisible=new Array(0,0); 01296 var GLV_x=0; 01297 var GLV_y=0; 01298 var GLV_xRel=0; 01299 var GLV_yRel=0; 01300 var layerObj=new Array(); 01301 var layerObjCss=new Array(); 01302 01303 //browsercheck... 01304 function GL_checkBrowser(){ // 01305 this.dom= (document.getElementById); 01306 this.safari = (navigator.userAgent.indexOf("Safari")>-1); 01307 this.op= (navigator.userAgent.indexOf("Opera")>-1); 01308 this.op7= this.op && (navigator.appVersion.indexOf("7")>-1); // check for Opera version 7 01309 this.konq= (navigator.userAgent.indexOf("Konq")>-1); 01310 this.ie4= (document.all && !this.dom && !this.op && !this.konq); 01311 this.ie5= (document.all && this.dom && !this.op && !this.konq); 01312 this.ns4= (document.layers && !this.dom && !this.konq); 01313 this.ns5= (!document.all && this.dom && !this.op && !this.konq); 01314 this.ns6= (this.ns5); 01315 this.bw= (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.op || this.konq); 01316 return this; 01317 } 01318 bw= new GL_checkBrowser(); 01319 01320 // GL_getObj(obj) 01321 function GL_getObj(obj){ // 01322 nest=""; 01323 this.el= (bw.ie4||bw.op7)?document.all[obj]:bw.ns4?eval(nest+"document."+obj):document.getElementById(obj); 01324 this.css= bw.ns4?this.el:this.el.style; 01325 this.ref= bw.ns4?this.el.document:document; 01326 this.x= (bw.ns4||bw.op)?this.css.left:this.el.offsetLeft; 01327 this.y= (bw.ns4||bw.op)?this.css.top:this.el.offsetTop; 01328 this.height= (bw.ie4||bw.dom)?this.el.offsetHeight:bw.ns4?this.ref.height:0; 01329 this.width= (bw.ie4||bw.dom)?this.el.offsetWidth:bw.ns4?this.ref.width:0; 01330 return this; 01331 } 01332 // GL_getObjCss(obj) 01333 function GL_getObjCss(obj){ // 01334 return bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0; 01335 } 01336 // GL_getMouse(event) 01337 function GL_getMouse(event) { // 01338 if (layerObj) { 01339 // GLV_x= (bw.ns4||bw.ns5)?event.pageX:(bw.ie4||bw.op)?event.clientX:(event.clientX-2)+document.body.scrollLeft; 01340 // GLV_y= (bw.ns4||bw.ns5)?event.pageY:(bw.ie4||bw.op)?event.clientY:(event.clientY-2)+document.body.scrollTop; 01341 // 17/12 2003: When documents run in XHTML standard compliance mode, the old scrollLeft/Top properties of document.body is gone - and for Opera/MSIE we have to use document.documentElement: 01342 01343 GLV_xRel = event.clientX-2; 01344 GLV_yRel = event.clientY-2; 01345 01346 GLV_x = GLV_xRel; 01347 GLV_y = GLV_yRel; 01348 01349 GLV_x = GLV_xRel + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); 01350 GLV_y = GLV_yRel + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 01351 01352 // status = (GLV_x+GLV_gap-GLV_curLayerX[0]) + " | " + (GLV_y+GLV_gap-GLV_curLayerY[0]); 01353 if (GLV_isVisible[1]) { 01354 if (outsideLayer(1)) hideSpecific(1); 01355 } else if (GLV_isVisible[0]) { 01356 if (outsideLayer(0)) hideSpecific(0); 01357 } 01358 } 01359 } 01360 // outsideLayer(level) 01361 function outsideLayer(level) { // 01362 return GLV_x+GLV_gap-GLV_curLayerX[level] <0 || 01363 GLV_y+GLV_gap-GLV_curLayerY[level] <0 || 01364 GLV_curLayerX[level]+GLV_curLayerWidth[level]+GLV_gap-GLV_x <0 || 01365 GLV_curLayerY[level]+GLV_curLayerHeight[level]+GLV_gap-GLV_y <0; 01366 } 01367 // setLayerObj(html,level) 01368 function setLayerObj(html,level) { // 01369 var winHeight = document.documentElement.clientHeight && !bw.op7 ? document.documentElement.clientHeight : document.body.clientHeight; 01370 var winWidth = document.documentElement.clientWidth && !bw.op7 ? document.documentElement.clientWidth : document.body.clientWidth; 01371 var tempLayerObj = GL_getObj("contentMenu"+level); 01372 var tempLayerObjCss = GL_getObjCss("contentMenu"+level); 01373 01374 if (tempLayerObj && (level==0 || GLV_isVisible[level-1])) { 01375 tempLayerObj.el.innerHTML = html; 01376 tempLayerObj.width= (bw.ie4||bw.dom)?this.el.offsetWidth:bw.ns4?this.ref.width:0; 01377 tempLayerObj.height= (bw.ie4||bw.dom)?this.el.offsetHeight:bw.ns4?this.ref.height:0; 01378 01379 // konqueror (3.2.2) workaround 01380 winHeight = (bw.konq)?window.innerHeight:winHeight; 01381 winWidth = (bw.konq)?window.innerWidth:winWidth; 01382 01383 // Adjusting the Y-height of the layer to fit it into the window frame if it goes under the window frame in the bottom: 01384 if (winHeight-tempLayerObj.height < GLV_yRel) { 01385 if (GLV_yRel < tempLayerObj.height) { 01386 GLV_y+= (winHeight-tempLayerObj.height-GLV_yRel); // Setting it so bottom is just above window height. 01387 } else { 01388 GLV_y-= tempLayerObj.height-8; // Showing the menu upwards 01389 } 01390 } 01391 // Adjusting the X position like Y above 01392 if (winWidth-tempLayerObj.width < GLV_xRel) { 01393 if (GLV_xRel < tempLayerObj.width) { 01394 GLV_x+= (winWidth-tempLayerObj.width-GLV_xRel); 01395 } else { 01396 GLV_x-= tempLayerObj.width-8; 01397 } 01398 } 01399 GLV_x = Math.max(GLV_x,1); 01400 GLV_y = Math.max(GLV_y,1); 01401 01402 GLV_curLayerX[level] = GLV_x; 01403 GLV_curLayerY[level] = GLV_y; 01404 tempLayerObjCss.left = GLV_x+"px"; 01405 tempLayerObjCss.top = GLV_y+"px"; 01406 tempLayerObjCss.visibility = "visible"; 01407 if (bw.ie5) showHideSelectorBoxes("hidden"); 01408 01409 GLV_isVisible[level]=1; 01410 GLV_curLayerWidth[level] = tempLayerObj.width; 01411 GLV_curLayerHeight[level] = tempLayerObj.height; 01412 } 01413 } 01414 // hideEmpty() 01415 function hideEmpty() { // 01416 hideSpecific(0); 01417 hideSpecific(1); 01418 return false; 01419 } 01420 // hideSpecific(level) 01421 function hideSpecific(level) { // 01422 GL_getObjCss("contentMenu"+level).visibility = "hidden"; 01423 GL_getObj("contentMenu"+level).el.innerHTML = ""; 01424 GLV_isVisible[level]=0; 01425 01426 if (bw.ie5 && level==0) showHideSelectorBoxes("visible"); 01427 } 01428 // debugObj(obj,name) 01429 function debugObj(obj,name) { // 01430 var acc; 01431 for (i in obj) {if (obj[i]) {acc+=i+": "+obj[i]+"\n";}} 01432 alert("Object: "+name+"\n\n"+acc); 01433 } 01434 // initLayer() 01435 function initLayer(){ // 01436 if (document.all) { 01437 window.onmousemove=GL_getMouse; 01438 } 01439 layerObj = GL_getObj("contentMenu1"); 01440 layerObjCss = GL_getObjCss("contentMenu1"); 01441 } 01442 function showHideSelectorBoxes(action) { // This function by Michiel van Leening 01443 for (i=0;i<document.forms.length;i++) { 01444 for (j=0;j<document.forms[i].elements.length;j++) { 01445 if(document.forms[i].elements[j].type=="select-one") { 01446 document.forms[i].elements[j].style.visibility=action; 01447 } 01448 } 01449 } 01450 }'; 01451 $content.=' /*]]>*/ 01452 </script>'; 01453 return array( 01454 $content, 01455 ' onmousemove="GL_getMouse(event);" onload="initLayer();"', 01456 '<div id="contentMenu0" style="z-index:1; position:absolute;visibility:hidden"></div><div id="contentMenu1" style="z-index:2; position:absolute;visibility:hidden"></div>' 01457 ); 01458 } else { 01459 $content.=' /*]]>*/ 01460 </script>'; 01461 return array($content,'',''); 01462 } 01463 } 01464 01471 function getDragDropCode($table) { 01472 $content = ' 01473 <script type="text/javascript"> 01474 /*<![CDATA[*/ 01475 '; 01476 01477 if ($this->isCMlayers()) { 01478 $content.= ' 01479 var dragID = null; 01480 var dragIconCSS = null; 01481 01482 function cancelDragEvent(event) { 01483 dragID = null; 01484 dragIconCSS.visibility = "hidden"; 01485 document.onmouseup = null; 01486 document.onmousemove = null; 01487 } 01488 01495 function mouseMoveEvent (event) { 01496 dragIconCSS.left = GLV_x+5+"px"; 01497 dragIconCSS.top = GLV_y-5+"px"; 01498 dragIconCSS.visibility = "visible"; 01499 return false; 01500 } 01501 01508 function dragElement(id,elementID) { 01509 dragID = id; 01510 if (elementID == null) { 01511 elementID = id; 01512 } 01513 document.getElementById("dragIcon").innerHTML=document.getElementById("dragIconID_"+elementID).innerHTML + document.getElementById("dragTitleID_"+elementID).getElementsByTagName("a")[0].innerHTML; 01514 dragIconCSS = new GL_getObjCss("dragIcon"); 01515 dragIconCSS.whiteSpace = "nowrap"; 01516 document.onmouseup = cancelDragEvent; 01517 document.onmousemove = mouseMoveEvent; 01518 return false; 01519 } 01520 01527 function dropElement(id) { 01528 if ((dragID != null) && (dragID != id)) { 01529 var url = "'.$this->backPath.'alt_clickmenu.php?dragDrop='.$table.'" 01530 + "&srcId=" + dragID 01531 + "&dstId=" + id 01532 + "&backPath='.t3lib_div::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'"; 01533 showClickmenu_raw(url); 01534 } 01535 cancelDragEvent(); 01536 return false; 01537 } 01538 '; 01539 } 01540 else { 01541 $content.= ' 01542 function dragElement(id) { return false; } 01543 function dropElement(id) { return false; } 01544 '; 01545 } 01546 $content.=' 01547 /*]]>*/ 01548 </script>'; 01549 01550 if ($this->isCMlayers()) { 01551 return array( 01552 $content, 01553 '', 01554 '<div id="dragIcon" style="z-index:1;position:absolute;visibility:hidden;filter:alpha(opacity=50);-moz-opacity:0.5;opacity:0.5;"><img src="" width="18" height="16"></div>' 01555 ); 01556 } else { 01557 return array($content,'',''); 01558 } 01559 } 01560 01576 function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') { 01577 $content=''; 01578 01579 if (is_array($menuItems)) { 01580 if (!is_array($mainParams)) { 01581 $mainParams = array('id' => $mainParams); 01582 } 01583 $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams); 01584 01585 if (!$script) {$script=basename(PATH_thisScript);} 01586 01587 $menuDef = array(); 01588 foreach($menuItems as $value => $label) { 01589 $menuDef[$value]['isActive'] = !strcmp($currentValue,$value); 01590 $menuDef[$value]['label'] = t3lib_div::deHSCentities(htmlspecialchars($label)); 01591 $menuDef[$value]['url'] = htmlspecialchars($script.'?'.$mainParams.$addparams.'&'.$elementName.'='.$value); 01592 } 01593 $content = $this->getTabMenuRaw($menuDef); 01594 01595 } 01596 return $content; 01597 } 01598 01606 function getTabMenuRaw($menuItems) { 01607 $content=''; 01608 01609 if (is_array($menuItems)) { 01610 $options=''; 01611 01612 $count = count($menuItems); 01613 $widthLeft = 1; 01614 $addToAct = 5; 01615 01616 $widthRight = max (1,floor(30-pow($count,1.72))); 01617 $widthTabs = 100 - $widthRight - $widthLeft; 01618 $widthNo = floor(($widthTabs - $addToAct)/$count); 01619 $addToAct = max ($addToAct,$widthTabs-($widthNo*$count)); 01620 $widthAct = $widthNo + $addToAct; 01621 $widthRight = 100 - ($widthLeft + ($count*$widthNo) + $addToAct); 01622 01623 $first=true; 01624 foreach($menuItems as $id => $def) { 01625 $isActive = $def['isActive']; 01626 $class = $isActive ? 'tabact' : 'tab'; 01627 $width = $isActive ? $widthAct : $widthNo; 01628 01629 // @rene: Here you should probably wrap $label and $url in htmlspecialchars() in order to make sure its XHTML compatible! I did it for $url already since that is VERY likely to break. 01630 $label = $def['label']; 01631 $url = htmlspecialchars($def['url']); 01632 $params = $def['addParams']; 01633 01634 if($first) { 01635 $options.= ' 01636 <td width="'.$width.'%" class="'.$class.'" style="border-left: solid #000 1px;"><a href="'.$url.'" style="padding-left:5px;padding-right:2px;" '.$params.'>'.$label.'</a></td>'; 01637 } else { 01638 $options.=' 01639 <td width="'.$width.'%" class="'.$class.'"><a href="'.$url.'" '.$params.'>'.$label.'</a></td>'; 01640 } 01641 $first=false; 01642 } 01643 01644 if ($options) { 01645 $content .= ' 01646 <!-- Tab menu --> 01647 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="typo3-tabmenu"> 01648 <tr> 01649 <td width="'.$widthLeft.'%"> </td> 01650 '.$options.' 01651 <td width="'.$widthRight.'%"> </td> 01652 </tr> 01653 </table> 01654 <div class="hr" style="margin:0px"></div>'; 01655 } 01656 01657 } 01658 return $content; 01659 } 01660 01675 function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1) { 01676 $content = ''; 01677 01678 if (is_array($menuItems)) { 01679 01680 // Init: 01681 $options = array(array()); 01682 $divs = array(); 01683 $JSinit = array(); 01684 $id = $this->getDynTabMenuId($identString); 01685 $noWrap = $noWrap ? ' nowrap="nowrap"' : ''; 01686 01687 // Traverse menu items 01688 $c=0; 01689 $tabRows=0; 01690 $titleLenCount = 0; 01691 foreach($menuItems as $index => $def) { 01692 $index+=1; // Need to add one so checking for first index in JavaScript is different than if it is not set at all. 01693 01694 // Switch to next tab row if needed 01695 if (!$foldout && $titleLenCount>$newRowCharLimit) { // 50 characters is probably a reasonable count of characters before switching to next row of tabs. 01696 $titleLenCount=0; 01697 $tabRows++; 01698 $options[$tabRows] = array(); 01699 } 01700 01701 if ($toggle==1) { 01702 $onclick = 'this.blur(); DTM_toggle("'.$id.'","'.$index.'"); return false;'; 01703 } else { 01704 $onclick = 'this.blur(); DTM_activate("'.$id.'","'.$index.'", '.($toggle<0?1:0).'); return false;'; 01705 } 01706 01707 $isActive = strcmp($def['content'],''); 01708 01709 $mouseOverOut = ' onmouseover="DTM_mouseOver(this);" onmouseout="DTM_mouseOut(this);"'; 01710 01711 if (!$foldout) { 01712 // Create TAB cell: 01713 $options[$tabRows][] = ' 01714 <td class="'.($isActive ? 'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$noWrap.$mouseOverOut.'>'. 01715 ($isActive ? '<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ? ' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : ''). 01716 $def['icon']. 01717 ($def['label'] ? htmlspecialchars($def['label']) : ' '). 01718 $this->icons($def['stateIcon'],'margin-left: 10px;'). 01719 ($isActive ? '</a>' :''). 01720 '</td>'; 01721 $titleLenCount+= strlen($def['label']); 01722 } else { 01723 // Create DIV layer for content: 01724 $divs[] = ' 01725 <div class="'.($isActive ? 'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$mouseOverOut.'>'. 01726 ($isActive ? '<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ? ' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : ''). 01727 $def['icon']. 01728 ($def['label'] ? htmlspecialchars($def['label']) : ' '). 01729 ($isActive ? '</a>' : ''). 01730 '</div>'; 01731 } 01732 01733 if ($isActive) { 01734 // Create DIV layer for content: 01735 $divs[] = ' 01736 <div style="display: none;" id="'.$id.'-'.$index.'-DIV" class="c-tablayer">'. 01737 ($def['description'] ? '<p class="c-descr">'.nl2br(htmlspecialchars($def['description'])).'</p>' : ''). 01738 $def['content']. 01739 '</div>'; 01740 // Create initialization string: 01741 $JSinit[] = ' 01742 DTM_array["'.$id.'"]['.$c.'] = "'.$id.'-'.$index.'"; 01743 '; 01744 if ($toggle==1) { 01745 $JSinit[] = ' 01746 if (top.DTM_currentTabs["'.$id.'-'.$index.'"]) { DTM_toggle("'.$id.'","'.$index.'",1); } 01747 '; 01748 } 01749 01750 $c++; 01751 } 01752 } 01753 01754 // Render menu: 01755 if (count($options)) { 01756 01757 // Tab menu is compiled: 01758 if (!$foldout) { 01759 $tabContent = ''; 01760 for($a=0;$a<=$tabRows;$a++) { 01761 $tabContent.= ' 01762 01763 <!-- Tab menu --> 01764 <table cellpadding="0" cellspacing="0" border="0"'.($fullWidth ? ' width="100%"' : '').' class="typo3-dyntabmenu"> 01765 <tr> 01766 '.implode('',$options[$a]).' 01767 </tr> 01768 </table>'; 01769 } 01770 $content.= '<div class="typo3-dyntabmenu-tabs">'.$tabContent.'</div>'; 01771 } 01772 01773 // Div layers are added: 01774 $content.= ' 01775 <!-- Div layers for tab menu: --> 01776 <div class="typo3-dyntabmenu-divs'.($foldout?'-foldout':'').'"> 01777 '.implode('',$divs).'</div>'; 01778 01779 // Java Script section added: 01780 $content.= ' 01781 <!-- Initialization JavaScript for the menu --> 01782 <script type="text/javascript"> 01783 DTM_array["'.$id.'"] = new Array(); 01784 '.implode('',$JSinit).' 01785 '.($toggle<=0 ? 'DTM_activate("'.$id.'", top.DTM_currentTabs["'.$id.'"]?top.DTM_currentTabs["'.$id.'"]:'.intval($defaultTabIndex).', 0);' : '').' 01786 </script> 01787 01788 '; 01789 } 01790 01791 } 01792 return $content; 01793 } 01794 01801 function getDynTabMenuId($identString) { 01802 $id = 'DTM-'.t3lib_div::shortMD5($identString); 01803 return $id; 01804 } 01805 01811 function getDynTabMenuJScode() { 01812 return ' 01813 <script type="text/javascript"> 01814 /*<![CDATA[*/ 01815 var DTM_array = new Array(); 01816 var DTM_origClass = new String(); 01817 01818 // if tabs are used in a popup window the array might not exists 01819 if(!top.DTM_currentTabs) { 01820 top.DTM_currentTabs = new Array(); 01821 } 01822 01823 function DTM_activate(idBase,index,doToogle) { // 01824 // Hiding all: 01825 if (DTM_array[idBase]) { 01826 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { 01827 if (DTM_array[idBase][cnt] != idBase+"-"+index) { 01828 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none"; 01829 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 01830 } 01831 } 01832 } 01833 01834 // Showing one: 01835 if (document.getElementById(idBase+"-"+index+"-DIV")) { 01836 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { 01837 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; 01838 if(DTM_origClass=="") { 01839 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 01840 } else { 01841 DTM_origClass = "tab"; 01842 } 01843 top.DTM_currentTabs[idBase] = -1; 01844 } else { 01845 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; 01846 if(DTM_origClass=="") { 01847 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; 01848 } else { 01849 DTM_origClass = "tabact"; 01850 } 01851 top.DTM_currentTabs[idBase] = index; 01852 } 01853 } 01854 } 01855 function DTM_toggle(idBase,index,isInit) { // 01856 // Showing one: 01857 if (document.getElementById(idBase+"-"+index+"-DIV")) { 01858 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { 01859 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; 01860 if(isInit) { 01861 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 01862 } else { 01863 DTM_origClass = "tab"; 01864 } 01865 top.DTM_currentTabs[idBase+"-"+index] = 0; 01866 } else { 01867 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; 01868 if(isInit) { 01869 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; 01870 } else { 01871 DTM_origClass = "tabact"; 01872 } 01873 top.DTM_currentTabs[idBase+"-"+index] = 1; 01874 } 01875 } 01876 } 01877 01878 function DTM_mouseOver(obj) { // 01879 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue; 01880 obj.attributes.getNamedItem(\'class\').nodeValue += "_over"; 01881 } 01882 01883 function DTM_mouseOut(obj) { // 01884 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass; 01885 DTM_origClass = ""; 01886 } 01887 01888 01889 /*]]>*/ 01890 </script> 01891 '; 01892 } 01893 01902 function getVersionSelector($id,$noAction=FALSE) { 01903 01904 if ($id>0) { 01905 if (t3lib_extMgm::isLoaded('version') && $GLOBALS['BE_USER']->workspace==0) { 01906 01907 // Get Current page record: 01908 $curPage = t3lib_BEfunc::getRecord('pages',$id); 01909 // If the selected page is not online, find the right ID 01910 $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id); 01911 // Select all versions of online version: 01912 $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id'); 01913 01914 // If more than one was found...: 01915 if (count($versions)>1) { 01916 01917 // Create selector box entries: 01918 $opt = array(); 01919 foreach($versions as $vRow) { 01920 $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$vRow['uid']))).'"'.($id==$vRow['uid']?' selected="selected"':'').'>'. 01921 htmlspecialchars($vRow['t3ver_label'].' [v#'.$vRow['t3ver_id'].', WS:'.$vRow['t3ver_wsid'].']'.($vRow['uid']==$onlineId ? ' =>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online').'<=':'')). 01922 '</option>'; 01923 } 01924 01925 // Add management link: 01926 $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$id))).'">---</option>'; 01927 $opt[] = '<option value="'.htmlspecialchars($this->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?table=pages&uid='.$onlineId).'">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.mgm',1).'</option>'; 01928 01929 // Create onchange handler: 01930 $onChange = "window.location.href=this.options[this.selectedIndex].value;"; 01931 01932 // Controls: 01933 if ($id==$onlineId) { 01934 $controls = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="absmiddle" alt="" /> <b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online',1).'</b>'; 01935 } elseif (!$noAction) { 01936 $controls = '<a href="'.$this->issueCommand('&cmd[pages]['.$onlineId.'][version][swapWith]='.$id.'&cmd[pages]['.$onlineId.'][version][action]=swap',t3lib_div::linkThisScript(array('id'=>$onlineId))).'" class="nobr">'. 01937 '<img'.t3lib_iconWorks::skinImg($this->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).'" />'. 01938 '<b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap',1).'</b></a>'; 01939 } 01940 01941 // Write out HTML code: 01942 return ' 01943 01944 <!-- 01945 Version selector: 01946 --> 01947 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 01948 <tr> 01949 <td>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.selVer',1).'</td> 01950 <td> 01951 <select onchange="'.htmlspecialchars($onChange).'"> 01952 '.implode('',$opt).' 01953 </select></td> 01954 <td>'.$controls.'</td> 01955 </tr> 01956 </table> 01957 '; 01958 } 01959 } elseif ($GLOBALS['BE_USER']->workspace!==0) { 01960 01961 // Write out HTML code: 01962 switch($GLOBALS['BE_USER']->workspace) { 01963 case 0: 01964 $wsTitle = 'LIVE'; 01965 break; 01966 case -1: 01967 $wsTitle = 'Draft'; 01968 break; 01969 default: 01970 $wsTitle = $GLOBALS['BE_USER']->workspaceRec['title']; 01971 break; 01972 } 01973 01974 if (t3lib_BEfunc::isPidInVersionizedBranch($id)=='branchpoint') { 01975 return ' 01976 01977 <!-- 01978 Version selector: 01979 --> 01980 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 01981 <tr> 01982 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 01983 <td><em>Inside branch, no further versioning possible</em></td> 01984 </tr> 01985 </table> 01986 '; 01987 } else { 01988 // Get Current page record: 01989 $curPage = t3lib_BEfunc::getRecord('pages',$id); 01990 // If the selected page is not online, find the right ID 01991 $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id); 01992 // The version of page: 01993 $verPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'pages', $onlineId); 01994 01995 if (!$verPage) { 01996 01997 if (!count(t3lib_BEfunc::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $onlineId))) { 01998 if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) { 01999 02000 $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=new&cmd[pages]['.$onlineId.'][version][treeLevels]=0',t3lib_div::linkThisScript(array('id'=>$onlineId))); 02001 $onClick = 'window.location.href=\''.$onClick.'\'; return false;'; 02002 // Write out HTML code: 02003 return ' 02004 02005 <!-- 02006 No version yet, create one? 02007 --> 02008 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 02009 <tr> 02010 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 02011 <td> 02012 <input type="submit" value="New version of page" name="_" onclick="'.htmlspecialchars($onClick).'" /></td> 02013 </tr> 02014 </table> 02015 '; 02016 } 02017 } else { 02018 return ' 02019 02020 <!-- 02021 Version selector: 02022 --> 02023 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 02024 <tr> 02025 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 02026 <td><em>Versions found on page, no "Page" versioning possible</em></td> 02027 </tr> 02028 </table> 02029 '; 02030 } 02031 } elseif ($verPage['t3ver_swapmode']==0) { 02032 $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=swap&cmd[pages]['.$onlineId.'][version][swapWith]='.$verPage['uid'],t3lib_div::linkThisScript(array('id'=>$onlineId))); 02033 $onClick = 'window.location.href=\''.$onClick.'\'; return false;'; 02034 02035 // Write out HTML code: 02036 return ' 02037 02038 <!-- 02039 Version selector: 02040 --> 02041 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 02042 <tr> 02043 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 02044 <td> 02045 <input type="submit" value="Publish page" name="_" onclick="'.htmlspecialchars($onClick).'" /></td> 02046 </tr> 02047 </table> 02048 '; 02049 } 02050 } 02051 } 02052 } 02053 } 02054 } 02055 02056 02057 02058 // ****************************** 02059 // Extension classes of the template class. 02060 // These are meant to provide backend screens with different widths. 02061 // They still do because of the different class-prefixes used for the <div>-sections 02062 // but obviously the final width is determined by the stylesheet used. 02063 // ****************************** 02064 02070 class bigDoc extends template { 02071 var $divClass = 'typo3-bigDoc'; 02072 } 02073 02079 class noDoc extends template { 02080 var $divClass = 'typo3-noDoc'; 02081 } 02082 02088 class smallDoc extends template { 02089 var $divClass = 'typo3-smallDoc'; 02090 } 02091 02097 class mediumDoc extends template { 02098 var $divClass = 'typo3-mediumDoc'; 02099 } 02100 02101 02102 02103 // Include extension to the template class? 02104 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']) { 02105 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']); 02106 } 02107 02108 02109 02110 // ****************************************************** 02111 // The backend language engine is started (ext: "lang") 02112 // ****************************************************** 02113 require_once(PATH_typo3.'sysext/lang/lang.php'); 02114 $LANG = t3lib_div::makeInstance('language'); 02115 $LANG->init($BE_USER->uc['lang']); 02116 02117 02118 02119 // ****************************** 02120 // The template is loaded 02121 // ****************************** 02122 $TBE_TEMPLATE = t3lib_div::makeInstance('template'); 02123 ?>