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.'","'.$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 (!$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 '.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)>2) { 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=" + 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 01280 function showClickmenu_noajax(url) { 01281 top.loadTopMenu(url); 01282 }'; 01283 if ($this->isCMlayers()) { 01284 $content .= t3lib_ajax::getJScode('showClickmenu_ajax', 'showClickmenu_noajax'); 01285 $content.=' 01286 // opens the clickmenu, is called from ajax_doRequest 01287 function showClickmenu_ajax(t3ajax) { 01288 if (t3ajax.getElementsByTagName("data")[0]) { 01289 var clickmenu = t3ajax.getElementsByTagName("data")[0].getElementsByTagName("clickmenu")[0]; 01290 var tableData = clickmenu.getElementsByTagName("htmltable")[0].firstChild.data; 01291 var cmlevel = clickmenu.getElementsByTagName("cmlevel")[0].firstChild.data; 01292 setLayerObj(tableData,cmlevel); 01293 } 01294 } 01295 01296 var GLV_gap=10; 01297 var GLV_curLayerX=new Array(0,0); 01298 var GLV_curLayerY=new Array(0,0); 01299 var GLV_curLayerWidth=new Array(0,0); 01300 var GLV_curLayerHeight=new Array(0,0); 01301 var GLV_isVisible=new Array(0,0); 01302 var GLV_x=0; 01303 var GLV_y=0; 01304 var GLV_xRel=0; 01305 var GLV_yRel=0; 01306 var layerObj=new Array(); 01307 var layerObjCss=new Array(); 01308 01309 //browsercheck... 01310 function GL_checkBrowser(){ // 01311 this.dom= (document.getElementById); 01312 this.op= (navigator.userAgent.indexOf("Opera")>-1); 01313 this.op7= this.op && (navigator.appVersion.indexOf("7")>-1); // check for Opera version 7 01314 this.konq= (navigator.userAgent.indexOf("Konq")>-1); 01315 this.ie4= (document.all && !this.dom && !this.op && !this.konq); 01316 this.ie5= (document.all && this.dom && !this.op && !this.konq); 01317 this.ns4= (document.layers && !this.dom && !this.konq); 01318 this.ns5= (!document.all && this.dom && !this.op && !this.konq); 01319 this.ns6= (this.ns5); 01320 this.bw= (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.op || this.konq); 01321 return this; 01322 } 01323 bw= new GL_checkBrowser(); 01324 01325 // GL_getObj(obj) 01326 function GL_getObj(obj){ // 01327 nest=""; 01328 this.el= (bw.ie4||bw.op7)?document.all[obj]:bw.ns4?eval(nest+"document."+obj):document.getElementById(obj); 01329 this.css= bw.ns4?this.el:this.el.style; 01330 this.ref= bw.ns4?this.el.document:document; 01331 this.x= (bw.ns4||bw.op)?this.css.left:this.el.offsetLeft; 01332 this.y= (bw.ns4||bw.op)?this.css.top:this.el.offsetTop; 01333 this.height= (bw.ie4||bw.dom)?this.el.offsetHeight:bw.ns4?this.ref.height:0; 01334 this.width= (bw.ie4||bw.dom)?this.el.offsetWidth:bw.ns4?this.ref.width:0; 01335 return this; 01336 } 01337 // GL_getObjCss(obj) 01338 function GL_getObjCss(obj){ // 01339 return bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0; 01340 } 01341 // GL_getMouse(event) 01342 function GL_getMouse(event) { // 01343 if (layerObj) { 01344 // GLV_x= (bw.ns4||bw.ns5)?event.pageX:(bw.ie4||bw.op)?event.clientX:(event.clientX-2)+document.body.scrollLeft; 01345 // GLV_y= (bw.ns4||bw.ns5)?event.pageY:(bw.ie4||bw.op)?event.clientY:(event.clientY-2)+document.body.scrollTop; 01346 // 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: 01347 01348 GLV_xRel = event.clientX-2; 01349 GLV_yRel = event.clientY-2; 01350 GLV_x = GLV_xRel + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); 01351 GLV_y = GLV_yRel + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 01352 01353 // status = (GLV_x+GLV_gap-GLV_curLayerX[0]) + " | " + (GLV_y+GLV_gap-GLV_curLayerY[0]); 01354 if (GLV_isVisible[1]) { 01355 if (outsideLayer(1)) hideSpecific(1); 01356 } else if (GLV_isVisible[0]) { 01357 if (outsideLayer(0)) hideSpecific(0); 01358 } 01359 } 01360 } 01361 // outsideLayer(level) 01362 function outsideLayer(level) { // 01363 return GLV_x+GLV_gap-GLV_curLayerX[level] <0 || 01364 GLV_y+GLV_gap-GLV_curLayerY[level] <0 || 01365 GLV_curLayerX[level]+GLV_curLayerWidth[level]+GLV_gap-GLV_x <0 || 01366 GLV_curLayerY[level]+GLV_curLayerHeight[level]+GLV_gap-GLV_y <0; 01367 } 01368 // setLayerObj(html,level) 01369 function setLayerObj(html,level) { // 01370 var winHeight = document.documentElement.clientHeight && !bw.op7 ? document.documentElement.clientHeight : document.body.clientHeight; 01371 var winWidth = document.documentElement.clientWidth && !bw.op7 ? document.documentElement.clientWidth : document.body.clientWidth; 01372 var tempLayerObj = GL_getObj("contentMenu"+level); 01373 var tempLayerObjCss = GL_getObjCss("contentMenu"+level); 01374 01375 if (tempLayerObj && (level==0 || GLV_isVisible[level-1])) { 01376 tempLayerObj.el.innerHTML = html; 01377 tempLayerObj.width= (bw.ie4||bw.dom)?this.el.offsetWidth:bw.ns4?this.ref.width:0; 01378 tempLayerObj.height= (bw.ie4||bw.dom)?this.el.offsetHeight:bw.ns4?this.ref.height:0; 01379 01380 // konqueror (3.2.2) workaround 01381 winHeight = (bw.konq)?window.innerHeight:winHeight; 01382 winWidth = (bw.konq)?window.innerWidth:winWidth; 01383 01384 // Adjusting the Y-height of the layer to fit it into the window frame if it goes under the window frame in the bottom: 01385 if (winHeight-tempLayerObj.height < GLV_yRel) { 01386 if (GLV_yRel < tempLayerObj.height) { 01387 GLV_y+= (winHeight-tempLayerObj.height-GLV_yRel); // Setting it so bottom is just above window height. 01388 } else { 01389 GLV_y-= tempLayerObj.height-8; // Showing the menu upwards 01390 } 01391 } 01392 // Adjusting the X position like Y above 01393 if (winWidth-tempLayerObj.width < GLV_xRel) { 01394 if (GLV_xRel < tempLayerObj.width) { 01395 GLV_x+= (winWidth-tempLayerObj.width-GLV_xRel); 01396 } else { 01397 GLV_x-= tempLayerObj.width-8; 01398 } 01399 } 01400 GLV_x = Math.max(GLV_x,1); 01401 GLV_y = Math.max(GLV_y,1); 01402 01403 GLV_curLayerX[level] = GLV_x; 01404 GLV_curLayerY[level] = GLV_y; 01405 tempLayerObjCss.left = GLV_x+"px"; 01406 tempLayerObjCss.top = GLV_y+"px"; 01407 tempLayerObjCss.visibility = "visible"; 01408 if (bw.ie5) showHideSelectorBoxes("hidden"); 01409 01410 GLV_isVisible[level]=1; 01411 GLV_curLayerWidth[level] = tempLayerObj.width; 01412 GLV_curLayerHeight[level] = tempLayerObj.height; 01413 } 01414 } 01415 // hideEmpty() 01416 function hideEmpty() { // 01417 hideSpecific(0); 01418 hideSpecific(1); 01419 return false; 01420 } 01421 // hideSpecific(level) 01422 function hideSpecific(level) { // 01423 GL_getObjCss("contentMenu"+level).visibility = "hidden"; 01424 GL_getObj("contentMenu"+level).el.innerHTML = ""; 01425 GLV_isVisible[level]=0; 01426 01427 if (bw.ie5 && level==0) showHideSelectorBoxes("visible"); 01428 } 01429 // debugObj(obj,name) 01430 function debugObj(obj,name) { // 01431 var acc; 01432 for (i in obj) {if (obj[i]) {acc+=i+": "+obj[i]+"\n";}} 01433 alert("Object: "+name+"\n\n"+acc); 01434 } 01435 // initLayer() 01436 function initLayer(){ // 01437 if (document.all) { 01438 window.onmousemove=GL_getMouse; 01439 } 01440 layerObj = GL_getObj("contentMenu1"); 01441 layerObjCss = GL_getObjCss("contentMenu1"); 01442 } 01443 function showHideSelectorBoxes(action) { // This function by Michiel van Leening 01444 for (i=0;i<document.forms.length;i++) { 01445 for (j=0;j<document.forms[i].elements.length;j++) { 01446 if(document.forms[i].elements[j].type=="select-one") { 01447 document.forms[i].elements[j].style.visibility=action; 01448 } 01449 } 01450 } 01451 }'; 01452 $content.=' /*]]>*/ 01453 </script>'; 01454 return array( 01455 $content, 01456 ' onmousemove="GL_getMouse(event);" onload="initLayer();"', 01457 '<div id="contentMenu0" style="z-index:1; position:absolute;visibility:hidden"></div><div id="contentMenu1" style="z-index:2; position:absolute;visibility:hidden"></div>' 01458 ); 01459 } else { 01460 $content.=' /*]]>*/ 01461 </script>'; 01462 return array($content,'',''); 01463 } 01464 } 01465 01472 function getDragDropCode($table) { 01473 $content = ' 01474 <script type="text/javascript"> 01475 /*<![CDATA[*/ 01476 '; 01477 01478 if ($this->isCMlayers()) { 01479 $content.= ' 01480 var dragID = null; 01481 var dragIconCSS = null; 01482 01483 function cancelDragEvent(event) { 01484 dragID = null; 01485 dragIconCSS.visibility = "hidden"; 01486 document.onmouseup = null; 01487 document.onmousemove = null; 01488 } 01489 01496 function mouseMoveEvent (event) { 01497 dragIconCSS.left = GLV_x+5+"px"; 01498 dragIconCSS.top = GLV_y-5+"px"; 01499 dragIconCSS.visibility = "visible"; 01500 return false; 01501 } 01502 01509 function dragElement(id,elementID) { 01510 dragID = id; 01511 if (elementID == null) { 01512 elementID = id; 01513 } 01514 document.getElementById("dragIcon").innerHTML=document.getElementById("dragIconID_"+elementID).innerHTML + document.getElementById("dragTitleID_"+elementID).getElementsByTagName("a")[0].innerHTML; 01515 dragIconCSS = new GL_getObjCss("dragIcon"); 01516 dragIconCSS.whiteSpace = "nowrap"; 01517 document.onmouseup = cancelDragEvent; 01518 document.onmousemove = mouseMoveEvent; 01519 return false; 01520 } 01521 01528 function dropElement(id) { 01529 if ((dragID != null) && (dragID != id)) { 01530 var url = "'.$this->backPath.'alt_clickmenu.php?dragDrop='.$table.'" 01531 + "&srcId=" + dragID 01532 + "&dstId=" + id 01533 + "&backPath='.t3lib_div::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'"; 01534 showClickmenu_raw(url); 01535 } 01536 cancelDragEvent(); 01537 return false; 01538 } 01539 '; 01540 } 01541 else { 01542 $content.= ' 01543 function dragElement(id) { return false; } 01544 function dropElement(id) { return false; } 01545 '; 01546 } 01547 $content.=' 01548 /*]]>*/ 01549 </script>'; 01550 01551 if ($this->isCMlayers()) { 01552 return array( 01553 $content, 01554 '', 01555 '<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>' 01556 ); 01557 } else { 01558 return array($content,'',''); 01559 } 01560 } 01561 01577 function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') { 01578 $content=''; 01579 01580 if (is_array($menuItems)) { 01581 if (!is_array($mainParams)) { 01582 $mainParams = array('id' => $mainParams); 01583 } 01584 $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams); 01585 01586 if (!$script) {$script=basename(PATH_thisScript);} 01587 01588 $menuDef = array(); 01589 foreach($menuItems as $value => $label) { 01590 $menuDef[$value]['isActive'] = !strcmp($currentValue,$value); 01591 $menuDef[$value]['label'] = t3lib_div::deHSCentities(htmlspecialchars($label)); 01592 $menuDef[$value]['url'] = htmlspecialchars($script.'?'.$mainParams.$addparams.'&'.$elementName.'='.$value); 01593 } 01594 $content = $this->getTabMenuRaw($menuDef); 01595 01596 } 01597 return $content; 01598 } 01599 01607 function getTabMenuRaw($menuItems) { 01608 $content=''; 01609 01610 if (is_array($menuItems)) { 01611 $options=''; 01612 01613 $count = count($menuItems); 01614 $widthLeft = 1; 01615 $addToAct = 5; 01616 01617 $widthRight = max (1,floor(30-pow($count,1.72))); 01618 $widthTabs = 100 - $widthRight - $widthLeft; 01619 $widthNo = floor(($widthTabs - $addToAct)/$count); 01620 $addToAct = max ($addToAct,$widthTabs-($widthNo*$count)); 01621 $widthAct = $widthNo + $addToAct; 01622 $widthRight = 100 - ($widthLeft + ($count*$widthNo) + $addToAct); 01623 01624 $first=true; 01625 foreach($menuItems as $id => $def) { 01626 $isActive = $def['isActive']; 01627 $class = $isActive ? 'tabact' : 'tab'; 01628 $width = $isActive ? $widthAct : $widthNo; 01629 01630 // @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. 01631 $label = $def['label']; 01632 $url = htmlspecialchars($def['url']); 01633 $params = $def['addParams']; 01634 01635 if($first) { 01636 $options.= ' 01637 <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>'; 01638 } else { 01639 $options.=' 01640 <td width="'.$width.'%" class="'.$class.'"><a href="'.$url.'" '.$params.'>'.$label.'</a></td>'; 01641 } 01642 $first=false; 01643 } 01644 01645 if ($options) { 01646 $content .= ' 01647 <!-- Tab menu --> 01648 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="typo3-tabmenu"> 01649 <tr> 01650 <td width="'.$widthLeft.'%"> </td> 01651 '.$options.' 01652 <td width="'.$widthRight.'%"> </td> 01653 </tr> 01654 </table> 01655 <div class="hr" style="margin:0px"></div>'; 01656 } 01657 01658 } 01659 return $content; 01660 } 01661 01676 function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1) { 01677 $content = ''; 01678 01679 if (is_array($menuItems)) { 01680 01681 // Init: 01682 $options = array(array()); 01683 $divs = array(); 01684 $JSinit = array(); 01685 $id = 'DTM-'.t3lib_div::shortMD5($identString); 01686 $noWrap = $noWrap ? ' nowrap="nowrap"' : ''; 01687 01688 // Traverse menu items 01689 $c=0; 01690 $tabRows=0; 01691 $titleLenCount = 0; 01692 foreach($menuItems as $index => $def) { 01693 $index+=1; // Need to add one so checking for first index in JavaScript is different than if it is not set at all. 01694 01695 // Switch to next tab row if needed 01696 if (!$foldout && $titleLenCount>$newRowCharLimit) { // 50 characters is probably a reasonable count of characters before switching to next row of tabs. 01697 $titleLenCount=0; 01698 $tabRows++; 01699 $options[$tabRows] = array(); 01700 } 01701 01702 if ($toggle==1) { 01703 $onclick = 'this.blur(); DTM_toggle("'.$id.'","'.$index.'"); return false;'; 01704 } else { 01705 $onclick = 'this.blur(); DTM_activate("'.$id.'","'.$index.'", '.($toggle<0?1:0).'); return false;'; 01706 } 01707 01708 $isActive = strcmp($def['content'],''); 01709 01710 $mouseOverOut = 'onmouseover="DTM_mouseOver(this);" onmouseout="DTM_mouseOut(this);"'; 01711 01712 if (!$foldout) { 01713 // Create TAB cell: 01714 $options[$tabRows][] = ' 01715 <td class="'.($isActive ? 'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$noWrap.$mouseOverOut.'>'. 01716 ($isActive ? '<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ? ' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : ''). 01717 $def['icon']. 01718 ($def['label'] ? htmlspecialchars($def['label']) : ' '). 01719 $this->icons($def['stateIcon'],'margin-left: 10px;'). 01720 ($isActive ? '</a>' :''). 01721 '</td>'; 01722 $titleLenCount+= strlen($def['label']); 01723 } else { 01724 // Create DIV layer for content: 01725 $divs[] = ' 01726 <div class="'.($isActive ? 'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$mouseOverOut.'>'. 01727 ($isActive ? '<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ? ' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : ''). 01728 $def['icon']. 01729 ($def['label'] ? htmlspecialchars($def['label']) : ' '). 01730 ($isActive ? '</a>' : ''). 01731 '</div>'; 01732 } 01733 01734 if ($isActive) { 01735 // Create DIV layer for content: 01736 $divs[] = ' 01737 <div style="display: none;" id="'.$id.'-'.$index.'-DIV" class="c-tablayer">'. 01738 ($def['description'] ? '<p class="c-descr">'.nl2br(htmlspecialchars($def['description'])).'</p>' : ''). 01739 $def['content']. 01740 '</div>'; 01741 // Create initialization string: 01742 $JSinit[] = ' 01743 DTM_array["'.$id.'"]['.$c.'] = "'.$id.'-'.$index.'"; 01744 '; 01745 if ($toggle==1) { 01746 $JSinit[] = ' 01747 if (top.DTM_currentTabs["'.$id.'-'.$index.'"]) { DTM_toggle("'.$id.'","'.$index.'",1); } 01748 '; 01749 } 01750 01751 $c++; 01752 } 01753 } 01754 01755 // Render menu: 01756 if (count($options)) { 01757 01758 // Tab menu is compiled: 01759 if (!$foldout) { 01760 $tabContent = ''; 01761 for($a=0;$a<=$tabRows;$a++) { 01762 $tabContent.= ' 01763 01764 <!-- Tab menu --> 01765 <table cellpadding="0" cellspacing="0" border="0"'.($fullWidth ? ' width="100%"' : '').' class="typo3-dyntabmenu"> 01766 <tr> 01767 '.implode('',$options[$a]).' 01768 </tr> 01769 </table>'; 01770 } 01771 $content.= '<div class="typo3-dyntabmenu-tabs">'.$tabContent.'</div>'; 01772 } 01773 01774 // Div layers are added: 01775 $content.= ' 01776 <!-- Div layers for tab menu: --> 01777 <div class="typo3-dyntabmenu-divs'.($foldout?'-foldout':'').'"> 01778 '.implode('',$divs).'</div>'; 01779 01780 // Java Script section added: 01781 $content.= ' 01782 <!-- Initialization JavaScript for the menu --> 01783 <script type="text/javascript"> 01784 DTM_array["'.$id.'"] = new Array(); 01785 '.implode('',$JSinit).' 01786 '.($toggle<=0 ? 'DTM_activate("'.$id.'", top.DTM_currentTabs["'.$id.'"]?top.DTM_currentTabs["'.$id.'"]:'.intval($defaultTabIndex).', 0);' : '').' 01787 </script> 01788 01789 '; 01790 } 01791 01792 } 01793 return $content; 01794 } 01795 01801 function getDynTabMenuJScode() { 01802 return ' 01803 <script type="text/javascript"> 01804 /*<![CDATA[*/ 01805 var DTM_array = new Array(); 01806 var DTM_origClass = new String(); 01807 01808 // if tabs are used in a popup window the array might not exists 01809 if(!top.DTM_currentTabs) { 01810 top.DTM_currentTabs = new Array(); 01811 } 01812 01813 function DTM_activate(idBase,index,doToogle) { // 01814 // Hiding all: 01815 if (DTM_array[idBase]) { 01816 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { 01817 if (DTM_array[idBase][cnt] != idBase+"-"+index) { 01818 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none"; 01819 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 01820 } 01821 } 01822 } 01823 01824 // Showing one: 01825 if (document.getElementById(idBase+"-"+index+"-DIV")) { 01826 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { 01827 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; 01828 if(DTM_origClass=="") { 01829 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 01830 } else { 01831 DTM_origClass = "tab"; 01832 } 01833 top.DTM_currentTabs[idBase] = -1; 01834 } else { 01835 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; 01836 if(DTM_origClass=="") { 01837 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; 01838 } else { 01839 DTM_origClass = "tabact"; 01840 } 01841 top.DTM_currentTabs[idBase] = index; 01842 } 01843 } 01844 } 01845 function DTM_toggle(idBase,index,isInit) { // 01846 // Showing one: 01847 if (document.getElementById(idBase+"-"+index+"-DIV")) { 01848 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { 01849 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; 01850 if(isInit) { 01851 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; 01852 } else { 01853 DTM_origClass = "tab"; 01854 } 01855 top.DTM_currentTabs[idBase+"-"+index] = 0; 01856 } else { 01857 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; 01858 if(isInit) { 01859 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; 01860 } else { 01861 DTM_origClass = "tabact"; 01862 } 01863 top.DTM_currentTabs[idBase+"-"+index] = 1; 01864 } 01865 } 01866 } 01867 01868 function DTM_mouseOver(obj) { // 01869 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue; 01870 obj.attributes.getNamedItem(\'class\').nodeValue += "_over"; 01871 } 01872 01873 function DTM_mouseOut(obj) { // 01874 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass; 01875 DTM_origClass = ""; 01876 } 01877 01878 01879 /*]]>*/ 01880 </script> 01881 '; 01882 } 01883 01892 function getVersionSelector($id,$noAction=FALSE) { 01893 01894 if ($id>0) { 01895 if (t3lib_extMgm::isLoaded('version') && $GLOBALS['BE_USER']->workspace==0) { 01896 01897 // Get Current page record: 01898 $curPage = t3lib_BEfunc::getRecord('pages',$id); 01899 // If the selected page is not online, find the right ID 01900 $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id); 01901 // Select all versions of online version: 01902 $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id'); 01903 01904 // If more than one was found...: 01905 if (count($versions)>1) { 01906 01907 // Create selector box entries: 01908 $opt = array(); 01909 foreach($versions as $vRow) { 01910 $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$vRow['uid']))).'"'.($id==$vRow['uid']?' selected="selected"':'').'>'. 01911 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').'<=':'')). 01912 '</option>'; 01913 } 01914 01915 // Add management link: 01916 $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$id))).'">---</option>'; 01917 $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>'; 01918 01919 // Create onchange handler: 01920 $onChange = "window.location.href=this.options[this.selectedIndex].value;"; 01921 01922 // Controls: 01923 if ($id==$onlineId) { 01924 $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>'; 01925 } elseif (!$noAction) { 01926 $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">'. 01927 '<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).'" />'. 01928 '<b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap',1).'</b></a>'; 01929 } 01930 01931 // Write out HTML code: 01932 return ' 01933 01934 <!-- 01935 Version selector: 01936 --> 01937 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 01938 <tr> 01939 <td>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.selVer',1).'</td> 01940 <td> 01941 <select onchange="'.htmlspecialchars($onChange).'"> 01942 '.implode('',$opt).' 01943 </select></td> 01944 <td>'.$controls.'</td> 01945 </tr> 01946 </table> 01947 '; 01948 } 01949 } elseif ($GLOBALS['BE_USER']->workspace!==0) { 01950 01951 // Write out HTML code: 01952 switch($GLOBALS['BE_USER']->workspace) { 01953 case 0: 01954 $wsTitle = 'LIVE'; 01955 break; 01956 case -1: 01957 $wsTitle = 'Draft'; 01958 break; 01959 default: 01960 $wsTitle = $GLOBALS['BE_USER']->workspaceRec['title']; 01961 break; 01962 } 01963 01964 if (t3lib_BEfunc::isPidInVersionizedBranch($id)=='branchpoint') { 01965 return ' 01966 01967 <!-- 01968 Version selector: 01969 --> 01970 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 01971 <tr> 01972 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 01973 <td><em>Inside branch, no further versioning possible</em></td> 01974 </tr> 01975 </table> 01976 '; 01977 } else { 01978 // Get Current page record: 01979 $curPage = t3lib_BEfunc::getRecord('pages',$id); 01980 // If the selected page is not online, find the right ID 01981 $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id); 01982 // The version of page: 01983 $verPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'pages', $onlineId); 01984 01985 if (!$verPage) { 01986 01987 if (!count(t3lib_BEfunc::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $onlineId))) { 01988 if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) { 01989 01990 $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=new&cmd[pages]['.$onlineId.'][version][treeLevels]=0',t3lib_div::linkThisScript(array('id'=>$onlineId))); 01991 $onClick = 'window.location.href=\''.$onClick.'\'; return false;'; 01992 // Write out HTML code: 01993 return ' 01994 01995 <!-- 01996 No version yet, create one? 01997 --> 01998 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 01999 <tr> 02000 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 02001 <td> 02002 <input type="submit" value="New version of page" name="_" onclick="'.htmlspecialchars($onClick).'" /></td> 02003 </tr> 02004 </table> 02005 '; 02006 } 02007 } else { 02008 return ' 02009 02010 <!-- 02011 Version selector: 02012 --> 02013 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 02014 <tr> 02015 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 02016 <td><em>Versions found on page, no "Page" versioning possible</em></td> 02017 </tr> 02018 </table> 02019 '; 02020 } 02021 } elseif ($verPage['t3ver_swapmode']==0) { 02022 $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=swap&cmd[pages]['.$onlineId.'][version][swapWith]='.$verPage['uid'],t3lib_div::linkThisScript(array('id'=>$onlineId))); 02023 $onClick = 'window.location.href=\''.$onClick.'\'; return false;'; 02024 02025 // Write out HTML code: 02026 return ' 02027 02028 <!-- 02029 Version selector: 02030 --> 02031 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> 02032 <tr> 02033 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td> 02034 <td> 02035 <input type="submit" value="Publish page" name="_" onclick="'.htmlspecialchars($onClick).'" /></td> 02036 </tr> 02037 </table> 02038 '; 02039 } 02040 } 02041 } 02042 } 02043 } 02044 } 02045 02046 02047 02048 // ****************************** 02049 // Extension classes of the template class. 02050 // These are meant to provide backend screens with different widths. 02051 // They still do because of the different class-prefixes used for the <div>-sections 02052 // but obviously the final width is determined by the stylesheet used. 02053 // ****************************** 02054 02060 class bigDoc extends template { 02061 var $divClass = 'typo3-bigDoc'; 02062 } 02063 02069 class noDoc extends template { 02070 var $divClass = 'typo3-noDoc'; 02071 } 02072 02078 class smallDoc extends template { 02079 var $divClass = 'typo3-smallDoc'; 02080 } 02081 02087 class mediumDoc extends template { 02088 var $divClass = 'typo3-mediumDoc'; 02089 } 02090 02091 02092 02093 // Include extension to the template class? 02094 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']) { 02095 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']); 02096 } 02097 02098 02099 02100 // ****************************************************** 02101 // The backend language engine is started (ext: "lang") 02102 // ****************************************************** 02103 require_once(PATH_typo3.'sysext/lang/lang.php'); 02104 $LANG = t3lib_div::makeInstance('language'); 02105 $LANG->init($BE_USER->uc['lang']); 02106 02107 02108 02109 // ****************************** 02110 // The template is loaded 02111 // ****************************** 02112 $TBE_TEMPLATE = t3lib_div::makeInstance('template'); 02113 ?>