00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00117 if (!defined('TYPO3_MODE')) die("Can't include this file directly.");
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00137 function fw($str) {
00138 return $str;
00139 }
00140
00141
00161 class template {
00162
00163
00164 var $backPath = '';
00165 var $form='';
00166 var $JScode='';
00167 var $JScodeArray = array();
00168 var $postCode='';
00169 var $docType = '';
00170
00171
00172 var $scriptID='';
00173 var $bodyTagId='';
00174 var $bodyTagAdditions='';
00175 var $inDocStyles='';
00176 var $inDocStylesArray=array();
00177 var $form_rowsToStylewidth = 9.58;
00178 var $form_largeComp = 1.33;
00179 var $endJS=1;
00180
00181
00182
00183 var $bgColor = '#F7F3EF';
00184 var $bgColor2 = '#9BA1A8';
00185 var $bgColor3 = '#F6F2E6';
00186 var $bgColor4 = '#D9D5C9';
00187 var $bgColor5 = '#ABBBB4';
00188 var $bgColor6 = '#E7DBA8';
00189 var $hoverColor = '#254D7B';
00190 var $styleSheetFile = 'stylesheet.css';
00191 var $styleSheetFile2 = '';
00192 var $styleSheetFile_post = '';
00193 var $backGroundImage = '';
00194 var $inDocStyles_TBEstyle = '';
00195
00196
00197 var $parseTimeFlag = 0;
00198
00199
00200 var $charset = 'iso-8859-1';
00201
00202 var $sectionFlag=0;
00203 var $divClass = '';
00204
00205
00206
00207
00208
00209
00216 function template() {
00217 global $TBE_STYLES;
00218
00219
00220 $this->scriptID = ereg_replace('^.*\/(sysext|ext)\/','ext/',substr(PATH_thisScript,strlen(PATH_site)));
00221 if (TYPO3_mainDir!='typo3/' && substr($this->scriptID,0,strlen(TYPO3_mainDir)) == TYPO3_mainDir) {
00222 $this->scriptID = 'typo3/'.substr($this->scriptID,strlen(TYPO3_mainDir));
00223 }
00224
00225 $this->bodyTagId = ereg_replace('[^[:alnum:]-]','-',$this->scriptID);
00226
00227
00228 if (is_array($TBE_STYLES['scriptIDindex'][$this->scriptID])) {
00229 $ovr = $TBE_STYLES['scriptIDindex'][$this->scriptID];
00230 $TBE_STYLES = t3lib_div::array_merge_recursive_overrule($TBE_STYLES,$ovr);
00231 unset($TBE_STYLES['scriptIDindex'][$this->scriptID]);
00232 }
00233
00234
00235 if ($TBE_STYLES['mainColors']['bgColor']) $this->bgColor=$TBE_STYLES['mainColors']['bgColor'];
00236 if ($TBE_STYLES['mainColors']['bgColor1']) $this->bgColor1=$TBE_STYLES['mainColors']['bgColor1'];
00237 if ($TBE_STYLES['mainColors']['bgColor2']) $this->bgColor2=$TBE_STYLES['mainColors']['bgColor2'];
00238 if ($TBE_STYLES['mainColors']['bgColor3']) $this->bgColor3=$TBE_STYLES['mainColors']['bgColor3'];
00239 if ($TBE_STYLES['mainColors']['bgColor4']) $this->bgColor4=$TBE_STYLES['mainColors']['bgColor4'];
00240 if ($TBE_STYLES['mainColors']['bgColor5']) $this->bgColor5=$TBE_STYLES['mainColors']['bgColor5'];
00241 if ($TBE_STYLES['mainColors']['bgColor6']) $this->bgColor6=$TBE_STYLES['mainColors']['bgColor6'];
00242 if ($TBE_STYLES['mainColors']['hoverColor']) $this->hoverColor=$TBE_STYLES['mainColors']['hoverColor'];
00243
00244
00245 if ($TBE_STYLES['stylesheet']) $this->styleSheetFile = $TBE_STYLES['stylesheet'];
00246 if ($TBE_STYLES['stylesheet2']) $this->styleSheetFile2 = $TBE_STYLES['stylesheet2'];
00247 if ($TBE_STYLES['styleSheetFile_post']) $this->styleSheetFile_post = $TBE_STYLES['styleSheetFile_post'];
00248 if ($TBE_STYLES['inDocStyles_TBEstyle']) $this->inDocStyles_TBEstyle = $TBE_STYLES['inDocStyles_TBEstyle'];
00249
00250
00251 if ($TBE_STYLES['background']) $this->backGroundImage = $TBE_STYLES['background'];
00252 }
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00290 function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE) {
00291 $backPath = '&backPath='.rawurlencode($this->backPath).'|'.t3lib_div::shortMD5($this->backPath.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
00292 $onClick = 'top.loadTopMenu(\''.$this->backPath.'alt_clickmenu.php?item='.rawurlencode($table.'|'.$uid.'|'.$listFr.'|'.$enDisItems).$backPath.$addParams.'\');'.$this->thisBlur().'return false;';
00293 return $returnOnClick ? $onClick : '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$str.'</a>';
00294 }
00295
00307 function viewPageIcon($id,$backPath,$addParams='hspace="3"') {
00308 global $BE_USER;
00309 $str = '';
00310
00311 if ($BE_USER->check('modules','web_list')) {
00312 $href=$backPath.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
00313 $str.= '<a href="'.htmlspecialchars($href).'">'.
00314 '<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="" />'.
00315 '</a>';
00316 }
00317
00318 $str.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($id,$backPath,t3lib_BEfunc::BEgetRootLine($id))).'">'.
00319 '<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="" />'.
00320 '</a>';
00321 return $str;
00322 }
00323
00333 function issueCommand($params,$rUrl='') {
00334 $rUrl = $rUrl ? $rUrl : t3lib_div::getIndpEnv('REQUEST_URI');
00335 return $this->backPath.'tce_db.php?'.
00336 $params.
00337 '&redirect='.($rUrl==-1?"'+T3_THIS_LOCATION+'":rawurlencode($rUrl)).
00338 '&vC='.rawurlencode($GLOBALS['BE_USER']->veriCode()).
00339 '&prErr=1&uPT=1';
00340 }
00341
00348 function isCMlayers() {
00349 return !$GLOBALS['BE_USER']->uc['disableCMlayers'] && $GLOBALS['CLIENT']['FORMSTYLE'] && $GLOBALS['CLIENT']['SYSTEM']!='mac';
00350 }
00351
00358 function thisBlur() {
00359 return ($GLOBALS['CLIENT']['FORMSTYLE']?'this.blur();':'');
00360 }
00361
00368 function helpStyle() {
00369 return $GLOBALS['CLIENT']['FORMSTYLE'] ? ' style="cursor:help;"':'';
00370 }
00371
00385 function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('','')) {
00386 global $TCA;
00387 if (is_array($row) && $row['uid']) {
00388 $iconImgTag=t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($path).'"');
00389 $title= strip_tags($row[$TCA[$table]['ctrl']['label']]);
00390 $viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'],$this->backPath,'');
00391 if ($table=='pages') $path.=' - '.t3lib_BEfunc::titleAttribForPages($row,'',0);
00392 } else {
00393 $iconImgTag='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif',$wHattribs='width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />';
00394 $title=$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
00395 }
00396
00397 return '<span class="typo3-moduleHeader">'.$this->wrapClickMenuOnIcon($iconImgTag,$table,$row['uid']).
00398 $viewPage.
00399 $tWrap[0].htmlspecialchars(t3lib_div::fixed_lgd_cs($title,45)).$tWrap[1].'</span>';
00400 }
00401
00411 function getFileheader($title,$path,$iconfile) {
00412 $fileInfo = t3lib_div::split_fileref($title);
00413 $title = htmlspecialchars(t3lib_div::fixed_lgd_cs($fileInfo['path'],-35)).'<b>'.htmlspecialchars($fileInfo['file']).'</b>';
00414 return '<span class="typo3-moduleHeader"><img'.t3lib_iconWorks::skinImg($this->backPath,$iconfile,'width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />'.$title.'</span>';
00415 }
00416
00426 function makeShortcutIcon($gvList,$setList,$modName,$motherModName="") {
00427 $backPath=$this->backPath;
00428 $storeUrl=$this->makeShortcutUrl($gvList,$setList);
00429 $pathInfo = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
00430
00431 if (!strcmp($motherModName,'1')) {
00432 $mMN="&motherModName='+top.currentModuleLoaded+'";
00433 } elseif ($motherModName) {
00434 $mMN='&motherModName='.rawurlencode($motherModName);
00435 } else $mMN="";
00436
00437 $onClick = 'if (top.shortcutFrame && confirm('.
00438 $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut')).
00439 ')){top.shortcutFrame.document.location=\''.$backPath.'alt_shortcut.php?modName='.rawurlencode($modName).
00440 '&URL='.rawurlencode($pathInfo['path']."?".$storeUrl).
00441 $mMN.
00442 '\';}return false;';
00443
00444 $sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'">
00445 <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>';
00446 return $sIcon;
00447 }
00448
00459 function makeShortcutUrl($gvList,$setList) {
00460 $GET = t3lib_div::_GET();
00461 $storeArray = array_merge(
00462 t3lib_div::compileSelectedGetVarsFromArray($gvList,$GET),
00463 array('SET'=>t3lib_div::compileSelectedGetVarsFromArray($setList,$GLOBALS['SOBE']->MOD_SETTINGS))
00464 );
00465 $storeUrl = t3lib_div::implodeArrayForUrl('',$storeArray);
00466 return $storeUrl;
00467 }
00468
00480 function formWidth($size=48,$textarea=0,$styleOverride='') {
00481 $wAttrib = $textarea?'cols':'size';
00482 if (!$GLOBALS['CLIENT']['FORMSTYLE']) {
00483 $size = $size;
00484 $retVal = ' '.$wAttrib.'="'.$size.'"';
00485 } else {
00486 $pixels = ceil($size*$this->form_rowsToStylewidth);
00487 $retVal = $styleOverride ? ' style="'.$styleOverride.'"' : ' style="width:'.$pixels.'px;"';
00488 }
00489 return $retVal;
00490 }
00491
00505 function formWidthText($size=48,$styleOverride='',$wrap='') {
00506 $wTags = $this->formWidth($size,1,$styleOverride);
00507
00508 if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) {
00509 $wTags.=' cols="'.$size.'"';
00510 }
00511 return $wTags;
00512 }
00513
00522 function redirectUrls($thisLocation='') {
00523 $thisLocation = $thisLocation?$thisLocation:t3lib_div::linkThisScript(
00524 array(
00525 'CB'=>'',
00526 'SET'=>'',
00527 'cmd' => '',
00528 'popViewId'=>''
00529 ));
00530
00531 $out ="
00532 var T3_RETURN_URL = '".str_replace('%20','',rawurlencode(t3lib_div::_GP('returnUrl')))."';
00533 var T3_THIS_LOCATION = '".str_replace('%20','',rawurlencode($thisLocation))."';
00534 ";
00535 return $out;
00536 }
00537
00546 function formatTime($tstamp,$type) {
00547 switch($type) {
00548 case 1: return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$tstamp); break;
00549 case 10: return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp); break;
00550 }
00551 }
00552
00559 function parseTime() {
00560 if ($this->parseTimeFlag && $GLOBALS['BE_USER']->isAdmin()) {
00561 return '<p>(ParseTime: '.(t3lib_div::milliseconds()-$GLOBALS['PARSETIME_START']).' ms</p>
00562 <p>REQUEST_URI-length: '.strlen(t3lib_div::getIndpEnv('REQUEST_URI')).')</p>';
00563 }
00564 }
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00592 function startPage($title) {
00593
00594 $charSet = $this->initCharset();
00595 $generator = $this->generator();
00596
00597
00598 # $this->JScodeArray[]='alert(document.compatMode);';
00599
00600
00601 header ('Content-Type:text/html;charset='.$this->charset);
00602
00603 switch($this->docType) {
00604 case 'xhtml_strict':
00605 $headerStart= '<!DOCTYPE html
00606 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
00607 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
00608 <?xml version="1.0" encoding="'.$this->charset.'"?>
00609 <?xml-stylesheet href="#internalStyle" type="text/css"?>
00610 ';
00611 break;
00612 case 'xhtml_trans':
00613 $headerStart= '<!DOCTYPE html
00614 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00615 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00616 <?xml version="1.0" encoding="'.$this->charset.'"?>
00617 <?xml-stylesheet href="#internalStyle" type="text/css"?>
00618 ';
00619 break;
00620 case 'xhtml_frames':
00621 $headerStart= '<!DOCTYPE html
00622 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
00623 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
00624 <?xml version="1.0" encoding="'.$this->charset.'"?>
00625 ';
00626 break;
00627 default:
00628 $headerStart='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
00629 break;
00630 }
00631
00632
00633 $str = $headerStart.'
00634 <html>
00635 <head>
00636 <!-- TYPO3 Script ID: '.htmlspecialchars($this->scriptID).' -->
00637 '.$charSet.'
00638 '.$generator.'
00639 <title>'.htmlspecialchars($title).'</title>
00640 '.$this->docStyle().'
00641 '.$this->JScode.'
00642 '.$this->wrapScriptTags(implode("\n", $this->JScodeArray)).'
00643 <!--###POSTJSMARKER###-->
00644 </head>
00645 ';
00646 $this->JScode='';
00647 $this->JScodeArray=array();
00648
00649 if ($this->docType=='xhtml_frames') {
00650 return $str;
00651 } else
00652 $str.=$this->docBodyTagBegin().
00653 ($this->divClass?'
00654
00655 <!-- Wrapping DIV-section for whole page BEGIN -->
00656 <div class="'.$this->divClass.'">
00657 ':'').trim($this->form);
00658 return $str;
00659 }
00660
00667 function endPage() {
00668 $str = $this->sectionEnd().
00669 $this->postCode.
00670 $this->endPageJS().
00671 t3lib_BEfunc::getSetUpdateSignal().
00672 $this->parseTime().
00673 ($this->form?'
00674 </form>':'').
00675 ($this->divClass?'
00676
00677 <!-- Wrapping DIV-section for whole page END -->
00678 </div>':'').
00679 '
00680 </body>
00681 </html> ';
00682
00683
00684 if (TYPO3_DLOG) t3lib_div::devLog('END of BACKEND session','',0,array('_FLUSH'=>TRUE));
00685
00686 return $str;
00687 }
00688
00696 function header($text) {
00697 $str='
00698
00699 <!-- MAIN Header in page top -->
00700 <h2>'.htmlspecialchars($text).'</h2>
00701 ';
00702 return $this->sectionEnd().$str;
00703 }
00704
00717 function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE) {
00718 $str='';
00719
00720
00721 if ($label) {
00722 if (!$allowHTMLinHeader) $label = htmlspecialchars($label);
00723 $str.=$this->sectionHeader($this->icons($type).$label, $sH, $nostrtoupper ? '' : ' class="uppercase"');
00724 }
00725
00726 $str.='
00727
00728 <!-- Section content -->
00729 '.$text;
00730
00731 return $this->sectionBegin().$str;
00732 }
00733
00741 function divider($dist) {
00742 $dist = intval($dist);
00743 $str='
00744
00745 <!-- DIVIDER -->
00746 <hr style="margin-top: '.$dist.'px; margin-bottom: '.$dist.'px;" />
00747 ';
00748 return $this->sectionEnd().$str;
00749 }
00750
00757 function spacer($dist) {
00758 if ($dist>0) {
00759 return '
00760
00761 <!-- Spacer element -->
00762 <div style="padding-top: '.intval($dist).'px;"></div>
00763 ';
00764 }
00765 }
00766
00776 function sectionHeader($label,$sH=FALSE,$addAttrib='') {
00777 $tag = ($sH?'h3':'h4');
00778 $str='
00779
00780 <!-- Section header -->
00781 <'.$tag.$addAttrib.'>'.$label.'</'.$tag.'>
00782 ';
00783 return $this->sectionBegin().$str;
00784 }
00785
00793 function sectionBegin() {
00794 if (!$this->sectionFlag) {
00795 $this->sectionFlag=1;
00796 $str='
00797
00798 <!-- ***********************
00799 Begin output section.
00800 *********************** -->
00801 <div>
00802 ';
00803 return $str;
00804 } else return '';
00805 }
00806
00814 function sectionEnd() {
00815 if ($this->sectionFlag) {
00816 $this->sectionFlag=0;
00817 return '
00818 </div>
00819 <!-- *********************
00820 End output section.
00821 ********************* -->
00822 ';
00823 } else return '';
00824 }
00825
00834 function middle() {
00835 }
00836
00843 function endPageJS() {
00844 return ($this->endJS?'
00845 <script type="text/javascript">
00846
00847 if (top.busy && top.busy.loginRefreshed) {
00848 top.busy.loginRefreshed();
00849 }
00850
00851 </script>':'');
00852 }
00853
00860 function docBodyTagBegin() {
00861 $bodyContent = 'body '.trim($this->bodyTagAdditions.($this->bodyTagId ? ' id="'.$this->bodyTagId.'"' : ''));
00862 return '<'.trim($bodyContent).'>';
00863 }
00864
00870 function docStyle() {
00871
00872
00873 if ($this->backGroundImage) {
00874 $this->inDocStylesArray[]=' BODY { background-image: url('.$this->backPath.$this->backGroundImage.'); }';
00875 }
00876
00877
00878 $this->inDocStylesArray[] = $this->inDocStyles;
00879 $this->inDocStylesArray[] = $this->inDocStyles_TBEstyle;
00880
00881
00882 $inDocStyles = implode('
00883 ',$this->inDocStylesArray);
00884
00885
00886 $style=trim('
00887 '.($this->styleSheetFile?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile.'" />':'').'
00888 '.($this->styleSheetFile2?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile2.'" />':'').'
00889 <style type="text/css" id="internalStyle">
00890
00891 '.trim($inDocStyles).'
00892
00893
00894 </style>
00895 '.($this->styleSheetFile_post?'<link rel="stylesheet" type="text/css" href="'.$this->backPath.$this->styleSheetFile_post.'" />':'')
00896 )
00897 ;
00898 $this->inDocStyles='';
00899 $this->inDocStylesArray=array();
00900
00901 return '
00902 '.$style;
00903 }
00904
00912 function insertStylesAndJS($content) {
00913
00914 $this->inDocStylesArray[] = $this->inDocStyles;
00915 $styles = "\n".implode("\n", $this->inDocStylesArray);
00916 $content = str_replace('',$styles,$content);
00917
00918
00919 $jscode = $this->JScode."\n".$this->wrapScriptTags(implode("\n", $this->JScodeArray));
00920 $content = str_replace('<!--###POSTJSMARKER###-->',$jscode,$content);
00921
00922 return $content;
00923 }
00924
00932 function initCharset() {
00933
00934 $this->charset = $GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : $this->charset;
00935
00936 return '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset.'" />';
00937 }
00938
00944 function generator() {
00945 $str = 'TYPO3 '.$GLOBALS['TYPO_VERSION'].', http:
00946 return '<meta name="GENERATOR" content="'.$str .'" />';
00947 }
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00977 function icons($type, $styleAttribValue='') {
00978 switch($type) {
00979 case '3':
00980 $icon = 'gfx/icon_fatalerror.gif';
00981 break;
00982 case '2':
00983 $icon = 'gfx/icon_warning.gif';
00984 break;
00985 case '1':
00986 $icon = 'gfx/icon_note.gif';
00987 break;
00988 case '-1':
00989 $icon = 'gfx/icon_ok.gif';
00990 break;
00991 default:
00992 break;
00993 }
00994 if ($icon) {
00995 return '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' class="absmiddle"'.($styleAttribValue ? ' style="'.htmlspecialchars($styleAttribValue).'"' : '').' alt="" />';
00996 }
00997 }
00998
01006 function t3Button($onClick,$label) {
01007 $button = '<input type="submit" onclick="'.htmlspecialchars($onClick).'; return false;" value="'.htmlspecialchars($label).'" />';
01008 return $button;
01009 }
01010
01017 function dfw($string) {
01018 return '<span class="typo3-dimmed">'.$string.'</span>';
01019 }
01020
01027 function rfw($string) {
01028 return '<span class="typo3-red">'.$string.'</span>';
01029 }
01030
01037 function wrapInCData($string) {
01038 $string = ''.
01039 $string.
01040 '';
01041
01042 return $string;
01043 }
01044
01054 function wrapScriptTags($string, $linebreak=TRUE) {
01055 if(trim($string)) {
01056
01057 $cr = $linebreak? "\n" : '';
01058
01059
01060 $string = preg_replace ('/^\n+/', '', $string);
01061
01062 if(preg_match('/^(\t+)/',$string,$match)) {
01063 $string = str_replace($match[1],"\t", $string);
01064 }
01065 $string = $cr.'<script type="text/javascript">
01066
01067 '.$string.'
01068
01069 </script>'.$cr;
01070 }
01071 return trim($string);
01072 }
01073
01074
01075
01076 var $tableLayout = Array (
01077 'defRow' => Array (
01078 'defCol' => Array('<td valign="top">','</td>')
01079 )
01080 );
01081 var $table_TR = '<tr>';
01082 var $table_TABLE = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-tmpltable">';
01083
01092 function table($arr, $layout='') {
01093 if (is_array($arr)) {
01094 $tableLayout = (is_array($layout)) ? $layout : $this->tableLayout;
01095
01096 reset($arr);
01097 $code='';
01098 $rc=0;
01099 while(list(,$val)=each($arr)) {
01100 if ($rc % 2) {
01101 $layout = is_array($tableLayout['defRowOdd']) ? $tableLayout['defRowOdd'] : $tableLayout['defRow'];
01102 } else {
01103 $layout = is_array($tableLayout['defRowEven']) ? $tableLayout['defRowEven'] : $tableLayout['defRow'];
01104 }
01105 $layoutRow = is_array($tableLayout[$rc]) ? $tableLayout[$rc] : $layout;
01106 $code_td='';
01107 if (is_array($val)) {
01108 $cc=0;
01109 while(list(,$content)=each($val)) {
01110 $wrap= is_array($layoutRow[$cc]) ? $layoutRow[$cc] : (is_array($layoutRow['defCol']) ? $layoutRow['defCol'] : (is_array($layout[$cc]) ? $layout[$cc] : $layout['defCol']));
01111 $code_td.=$wrap[0].$content.$wrap[1];
01112 $cc++;
01113 }
01114 }
01115 $trWrap = is_array($layoutRow['tr']) ? $layoutRow['tr'] : (is_array($layout['tr']) ? $layout['tr'] : array($this->table_TR, '</tr>'));
01116 $code.=$trWrap[0].$code_td.$trWrap[1];
01117 $rc++;
01118 }
01119 $tableWrap = is_array($tableLayout['table']) ? $tableLayout['table'] : array($this->table_TABLE, '</table>');
01120 $code=$tableWrap[0].$code.$tableWrap[1];
01121 }
01122 return $code;
01123 }
01124
01134 function menuTable($arr1,$arr2=array(), $arr3=array()) {
01135 $rows = max(array(count($arr1),count($arr2),count($arr3)));
01136
01137 $menu='
01138 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tablemenu">';
01139 for($a=0;$a<$rows;$a++) {
01140 $menu.='<tr>';
01141 $cls=array();
01142 $valign='middle';
01143 $cls[]='<td valign="'.$valign.'">'.$arr1[$a][0].'</td><td>'.$arr1[$a][1].'</td>';
01144 if (count($arr2)) {
01145 $cls[]='<td valign="'.$valign.'">'.$arr2[$a][0].'</td><td>'.$arr2[$a][1].'</td>';
01146 if (count($arr3)) {
01147 $cls[]='<td valign="'.$valign.'">'.$arr3[$a][0].'</td><td>'.$arr3[$a][1].'</td>';
01148 }
01149 }
01150 $menu.=implode($cls,'<td> </td>');
01151 $menu.='</tr>';
01152 }
01153 $menu.='
01154 </table>
01155 ';
01156 return $menu;
01157 }
01158
01167 function funcMenu($content,$menu) {
01168 return '
01169 <table border="0" cellpadding="0" cellspacing="0" width="100%" id="typo3-funcmenu">
01170 <tr>
01171 <td valign="top" nowrap="nowrap">'.$content.'</td>
01172 <td valign="top" align="right" nowrap="nowrap">'.$menu.'</td>
01173 </tr>
01174 </table>';
01175 }
01176
01185 function clearCacheMenu($id,$addSaveOptions=0) {
01186 global $BE_USER;
01187 $opt=$addOptions;
01188 if ($addSaveOptions) {
01189 $opt[]='<option value="">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.menu',1).'</option>';
01190 $opt[]='<option value="TBE_EDITOR_checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'</option>';
01191 $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>';
01192 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>';
01193 $opt[]='<option value="document.editform.closeDoc.value=2; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'</option>';
01194 $opt[]='<option value="document.editform.closeDoc.value=3; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeAllDocs',1).'</option>';
01195 $opt[]='<option value=""></option>';
01196 }
01197 $opt[]='<option value="">[ '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_clearCache',1).' ]</option>';
01198 if ($id) $opt[]='<option value="'.$id.'">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_thisPage',1).'</option>';
01199 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>';
01200 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>';
01201
01202 $onChange = 'if (!this.options[this.selectedIndex].value) {
01203 this.selectedIndex=0;
01204 } else if (this.options[this.selectedIndex].value.indexOf(\';\')!=-1) {
01205 eval(this.options[this.selectedIndex].value);
01206 }else{
01207 document.location=\''.$this->backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'&cacheCmd=\'+this.options[this.selectedIndex].value;
01208 }';
01209 $af_content = '<select name="cacheCmd" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
01210
01211 if (count($opt)>2) {
01212 return $af_content;
01213 }
01214 }
01215
01221 function getContextMenuCode() {
01222 if ($this->isCMlayers()) {
01223 $content='
01224 <script type="text/javascript">
01225
01226 var GLV_gap=10;
01227 var GLV_curLayerX=new Array(0,0);
01228 var GLV_curLayerY=new Array(0,0);
01229 var GLV_curLayerWidth=new Array(0,0);
01230 var GLV_curLayerHeight=new Array(0,0);
01231 var GLV_isVisible=new Array(0,0);
01232 var GLV_x=0;
01233 var GLV_y=0;
01234 var GLV_xRel=0;
01235 var GLV_yRel=0;
01236 var layerObj=new Array();
01237 var layerObjCss=new Array();
01238
01239
01240 function GL_checkBrowser(){
01241 this.dom= (document.getElementById);
01242 this.op= (navigator.userAgent.indexOf("Opera")>-1);
01243 this.op7= this.op && (navigator.appVersion.indexOf("7")>-1);
01244 this.konq= (navigator.userAgent.indexOf("Konq")>-1);
01245 this.ie4= (document.all && !this.dom && !this.op && !this.konq);
01246 this.ie5= (document.all && this.dom && !this.op && !this.konq);
01247 this.ns4= (document.layers && !this.dom && !this.konq);
01248 this.ns5= (!document.all && this.dom && !this.op && !this.konq);
01249 this.ns6= (this.ns5);
01250 this.bw= (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.op || this.konq);
01251 return this;
01252 }
01253 bw= new GL_checkBrowser();
01254
01255
01256 function GL_getObj(obj){
01257 nest="";
01258 this.el= (bw.ie4||bw.op7)?document.all[obj]:bw.ns4?eval(nest+"document."+obj):document.getElementById(obj);
01259 this.css= bw.ns4?this.el:this.el.style;
01260 this.ref= bw.ns4?this.el.document:document;
01261 this.x= (bw.ns4||bw.op)?this.css.left:this.el.offsetLeft;
01262 this.y= (bw.ns4||bw.op)?this.css.top:this.el.offsetTop;
01263 this.height= (bw.ie4||bw.ie5||bw.ns6||this.konq||bw.op7)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.op?this.css.pixelHeight:0;
01264 this.width= (bw.ie4||bw.ie5||bw.ns6||this.konq||bw.op7)?this.el.offsetWidth:bw.ns4?this.ref.width:bw.op?this.css.pixelWidth:0;
01265 return this;
01266 }
01267
01268 function GL_getObjCss(obj){
01269 return bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;
01270 }
01271
01272 function GL_getMouse(event) {
01273 if (layerObj) {
01274
01275
01276
01277
01278 GLV_xRel = event.clientX-2;
01279 GLV_yRel = event.clientY-2;
01280 GLV_x = GLV_xRel + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
01281 GLV_y = GLV_yRel + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
01282
01283
01284 if (GLV_isVisible[1]) {
01285 if (outsideLayer(1)) hideSpecific(1);
01286 } else if (GLV_isVisible[0]) {
01287 if (outsideLayer(0)) hideSpecific(0);
01288 }
01289 }
01290 }
01291
01292 function outsideLayer(level) {
01293 return GLV_x+GLV_gap-GLV_curLayerX[level] <0 ||
01294 GLV_y+GLV_gap-GLV_curLayerY[level] <0 ||
01295 GLV_curLayerX[level]+GLV_curLayerWidth[level]+GLV_gap-GLV_x <0 ||
01296 GLV_curLayerY[level]+GLV_curLayerHeight[level]+GLV_gap-GLV_y <0;
01297 }
01298
01299 function setLayerObj(html,level) {
01300 var winHeight = document.documentElement.clientHeight && !bw.op7 ? document.documentElement.clientHeight : document.body.clientHeight;
01301 var winWidth = document.documentElement.clientWidth && !bw.op7 ? document.documentElement.clientWidth : document.body.clientWidth;
01302 var tempLayerObj = GL_getObj("contentMenu"+level);
01303 var tempLayerObjCss = GL_getObjCss("contentMenu"+level);
01304
01305 if (tempLayerObj && (level==0 || GLV_isVisible[level-1])) {
01306 tempLayerObj.el.innerHTML = html;
01307 tempLayerObj.width= (bw.ie4||bw.ie5||bw.ns6||bw.konq||bw.op7)?this.el.offsetWidth:bw.ns4?this.ref.width:bw.op?this.css.pixelWidth:0;
01308 tempLayerObj.height= (bw.ie4||bw.ie5||bw.ns6||bw.konq||bw.op7)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.op?this.css.pixelHeight:0;
01309
01310
01311 winHeight = (bw.konq)?window.innerHeight:winHeight;
01312 winWidth = (bw.konq)?window.innerWidth:winWidth;
01313
01314
01315 if (winHeight-tempLayerObj.height < GLV_yRel) {
01316 if (GLV_yRel < tempLayerObj.height) {
01317 GLV_y+= (winHeight-tempLayerObj.height-GLV_yRel);
01318 } else {
01319 GLV_y-= tempLayerObj.height-8;
01320 }
01321 }
01322
01323 if (winWidth-tempLayerObj.width < GLV_xRel) {
01324 if (GLV_xRel < tempLayerObj.width) {
01325 GLV_x+= (winWidth-tempLayerObj.width-GLV_xRel);
01326 } else {
01327 GLV_x-= tempLayerObj.width-8;
01328 }
01329 }
01330 GLV_x = Math.max(GLV_x,1);
01331 GLV_y = Math.max(GLV_y,1);
01332
01333 GLV_curLayerX[level] = GLV_x;
01334 GLV_curLayerY[level] = GLV_y;
01335 tempLayerObjCss.left = GLV_x+"px";
01336 tempLayerObjCss.top = GLV_y+"px";
01337 tempLayerObjCss.visibility = "visible";
01338 if (bw.ie5) showHideSelectorBoxes("hidden");
01339
01340 GLV_isVisible[level]=1;
01341 GLV_curLayerWidth[level] = tempLayerObj.width;
01342 GLV_curLayerHeight[level] = tempLayerObj.height;
01343 }
01344 }
01345
01346 function hideEmpty() {
01347 hideSpecific(0);
01348 hideSpecific(1);
01349 return false;
01350 }
01351
01352 function hideSpecific(level) {
01353 GL_getObjCss("contentMenu"+level).visibility = "hidden";
01354 GL_getObj("contentMenu"+level).el.innerHTML = "";
01355 GLV_isVisible[level]=0;
01356
01357 if (bw.ie5 && level==0) showHideSelectorBoxes("visible");
01358 }
01359
01360 function debugObj(obj,name) {
01361 var acc;
01362 for (i in obj) {if (obj[i]) {acc+=i+": "+obj[i]+"\n";}}
01363 alert("Object: "+name+"\n\n"+acc);
01364 }
01365
01366 function initLayer(){
01367 if (document.all) {
01368 window.onmousemove=GL_getMouse;
01369 }
01370 layerObj = GL_getObj("contentMenu1");
01371 layerObjCss = GL_getObjCss("contentMenu1");
01372 }
01373 function showHideSelectorBoxes(action) {
01374 for (i=0;i<document.forms.length;i++) {
01375 for (j=0;j<document.forms[i].elements.length;j++) {
01376 if(document.forms[i].elements[j].type=="select-one") {
01377 document.forms[i].elements[j].style.visibility=action;
01378 }
01379 }
01380 }
01381 }
01382
01383 </script>
01384 ';
01385 return array(
01386 $content,
01387 ' onmousemove="GL_getMouse(event);" onload="initLayer();"',
01388 '<div id="contentMenu0" style="z-index:1; position:absolute;visibility:hidden"></div><div id="contentMenu1" style="z-index:2; position:absolute;visibility:hidden"></div>'
01389 );
01390 } else return array('','','');
01391 }
01392
01408 function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') {
01409 $content='';
01410
01411 if (is_array($menuItems)) {
01412 if (!is_array($mainParams)) {
01413 $mainParams = array('id' => $mainParams);
01414 }
01415 $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
01416
01417 if (!$script) {$script=basename(PATH_thisScript);}
01418
01419 $menuDef = array();
01420 foreach($menuItems as $value => $label) {
01421 $menuDef[$value]['isActive'] = !strcmp($currentValue,$value);
01422 $menuDef[$value]['label'] = t3lib_div::deHSCentities(htmlspecialchars($label));
01423 $menuDef[$value]['url'] = htmlspecialchars($script.'?'.$mainParams.$addparams.'&'.$elementName.'='.$value);
01424 }
01425 $content = $this->getTabMenuRaw($menuDef);
01426
01427 }
01428 return $content;
01429 }
01430
01438 function getTabMenuRaw($menuItems) {
01439 $content='';
01440
01441 if (is_array($menuItems)) {
01442 $options='';
01443
01444 $count = count($menuItems);
01445 $widthLeft = 1;
01446 $addToAct = 5;
01447
01448 $widthRight = max (1,floor(30-pow($count,1.72)));
01449 $widthTabs = 100 - $widthRight - $widthLeft;
01450 $widthNo = floor(($widthTabs - $addToAct)/$count);
01451 $addToAct = max ($addToAct,$widthTabs-($widthNo*$count));
01452 $widthAct = $widthNo + $addToAct;
01453 $widthRight = 100 - ($widthLeft + ($count*$widthNo) + $addToAct);
01454
01455 $first=true;
01456 foreach($menuItems as $id => $def) {
01457 $isActive = $def['isActive'];
01458 $class = $isActive ? 'tabact' : 'tab';
01459 $width = $isActive ? $widthAct : $widthNo;
01460
01461
01462 $label = $def['label'];
01463 $url = htmlspecialchars($def['url']);
01464 $params = $def['addParams'];
01465
01466 if($first) {
01467 $options.= '
01468 <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>';
01469 } else {
01470 $options.='
01471 <td width="'.$width.'%" class="'.$class.'"><a href="'.$url.'" '.$params.'>'.$label.'</a></td>';
01472 }
01473 $first=false;
01474 }
01475
01476 if ($options) {
01477 $content .= '
01478 <!-- Tab menu -->
01479 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="typo3-tabmenu">
01480 <tr>
01481 <td width="'.$widthLeft.'%"> </td>
01482 '.$options.'
01483 <td width="'.$widthRight.'%"> </td>
01484 </tr>
01485 </table>
01486 <div class="hr" style="margin:0px"></div>';
01487 }
01488
01489 }
01490 return $content;
01491 }
01492
01507 function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1) {
01508 $content = '';
01509
01510 if (is_array($menuItems)) {
01511
01512
01513 $options = array(array());
01514 $divs = array();
01515 $JSinit = array();
01516 $id = 'DTM-'.t3lib_div::shortMD5($identString);
01517 $noWrap = $noWrap ? ' nowrap="nowrap"' : '';
01518
01519
01520 $c=0;
01521 $tabRows=0;
01522 $titleLenCount = 0;
01523 foreach($menuItems as $index => $def) {
01524 $index+=1;
01525
01526
01527 if (!$foldout && $titleLenCount>$newRowCharLimit) {
01528 $titleLenCount=0;
01529 $tabRows++;
01530 $options[$tabRows] = array();
01531 }
01532
01533 if ($toggle==1) {
01534 $onclick = 'this.blur(); DTM_toggle("'.$id.'","'.$index.'"); return false;';
01535 } else {
01536 $onclick = 'this.blur(); DTM_activate("'.$id.'","'.$index.'", '.($toggle<0?1:0).'); return false;';
01537 }
01538
01539 $isActive = strcmp($def['content'],'');
01540
01541 if (!$foldout) {
01542
01543 $options[$tabRows][] = '
01544 <td class="'.($isActive ? 'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$noWrap.'>'.
01545 ($isActive ? '<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ? ' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : '').
01546 $def['icon'].
01547 ($def['label'] ? htmlspecialchars($def['label']) : ' ').
01548 $this->icons($def['stateIcon'],'margin-left: 10px;').
01549 ($isActive ? '</a>' :'').
01550 '</td>';
01551 $titleLenCount+= strlen($def['label']);
01552 } else {
01553
01554 $divs[] = '
01555 <div class="'.($isActive ? 'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU">'.
01556 ($isActive ? '<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ? ' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : '').
01557 ($def['label'] ? htmlspecialchars($def['label']) : ' ').
01558 ($isActive ? '</a>' : '').
01559 '</div>';
01560 }
01561
01562 if ($isActive) {
01563
01564 $divs[] = '
01565 <div style="display: none;" id="'.$id.'-'.$index.'-DIV" class="c-tablayer">'.
01566 ($def['description'] ? '<p class="c-descr">'.nl2br(htmlspecialchars($def['description'])).'</p>' : '').
01567 $def['content'].
01568 '</div>';
01569
01570 $JSinit[] = '
01571 DTM_array["'.$id.'"]['.$c.'] = "'.$id.'-'.$index.'";
01572 ';
01573 if ($toggle==1) {
01574 $JSinit[] = '
01575 if (top.DTM_currentTabs["'.$id.'-'.$index.'"]) { DTM_toggle("'.$id.'","'.$index.'"); }
01576 ';
01577 }
01578
01579 $c++;
01580 }
01581 }
01582
01583
01584 if (count($options)) {
01585
01586
01587 if (!$foldout) {
01588 $tabContent = '';
01589 for($a=0;$a<=$tabRows;$a++) {
01590 $tabContent.= '
01591
01592 <!-- Tab menu -->
01593 <table cellpadding="0" cellspacing="0" border="0"'.($fullWidth ? ' width="100%"' : '').' class="typo3-dyntabmenu">
01594 <tr>
01595 '.implode('',$options[$a]).'
01596 </tr>
01597 </table>';
01598 }
01599 $content.= '<div class="typo3-dyntabmenu-tabs">'.$tabContent.'</div>';
01600 }
01601
01602
01603 $content.= '
01604 <!-- Div layers for tab menu: -->
01605 <div class="typo3-dyntabmenu-divs'.($foldout?'-foldout':'').'">
01606 '.implode('',$divs).'</div>';
01607
01608
01609 $content.= '
01610 <!-- Initialization JavaScript for the menu -->
01611 <script type="text/javascript">
01612 DTM_array["'.$id.'"] = new Array();
01613 '.implode('',$JSinit).'
01614
01615 '.($toggle<=0 ? 'DTM_activate("'.$id.'", top.DTM_currentTabs["'.$id.'"]?top.DTM_currentTabs["'.$id.'"]:'.intval($defaultTabIndex).', 0);' : '').'
01616 </script>
01617
01618 ';
01619 }
01620
01621 }
01622 return $content;
01623 }
01624
01630 function getDynTabMenuJScode() {
01631 return '
01632 <script type="text/javascript">
01633
01634 var DTM_array = new Array();
01635
01636 function DTM_activate(idBase,index,doToogle) {
01637
01638 if (DTM_array[idBase]) {
01639 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
01640 if (DTM_array[idBase][cnt] != idBase+"-"+index) {
01641 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
01642 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
01643 }
01644 }
01645 }
01646
01647
01648 if (document.getElementById(idBase+"-"+index+"-DIV")) {
01649 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
01650 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
01651 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
01652 top.DTM_currentTabs[idBase] = -1;
01653 } else {
01654 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
01655 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
01656 top.DTM_currentTabs[idBase] = index;
01657 }
01658 }
01659 }
01660 function DTM_toggle(idBase,index) {
01661
01662 if (document.getElementById(idBase+"-"+index+"-DIV")) {
01663 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
01664 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
01665 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
01666 top.DTM_currentTabs[idBase+"-"+index] = 0;
01667 } else {
01668 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
01669 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
01670 top.DTM_currentTabs[idBase+"-"+index] = 1;
01671 }
01672 }
01673 }
01674
01675 </script>
01676 ';
01677 }
01678
01687 function getVersionSelector($id,$noAction=FALSE) {
01688
01689 if ($id>0 && t3lib_extMgm::isLoaded('version')) {
01690
01691
01692 $curPage = t3lib_BEfunc::getRecord('pages',$id);
01693
01694 $onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id);
01695
01696 $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_id');
01697
01698
01699 if (count($versions)>1) {
01700
01701
01702 $opt = array();
01703 foreach($versions as $vRow) {
01704 $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$vRow['uid']))).'"'.($id==$vRow['uid']?' selected="selected"':'').'>'.
01705 htmlspecialchars($vRow['t3ver_label'].' [v#'.$vRow['t3ver_id'].']'.($vRow['uid']==$onlineId ? ' =>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online').'<=':'')).
01706 '</option>';
01707 }
01708
01709
01710 $opt[] = '<option value="'.htmlspecialchars(t3lib_div::linkThisScript(array('id'=>$id))).'">---</option>';
01711 $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>';
01712
01713
01714 $onChange = "document.location=this.options[this.selectedIndex].value;";
01715
01716
01717 if ($id==$onlineId) {
01718 $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>';
01719 } elseif (!$noAction) {
01720 $controls = '<a href="'.$this->issueCommand('&cmd[pages]['.$onlineId.'][version][swapWith]='.$id.'&cmd[pages]['.$onlineId.'][version][action]=swap&cmd[pages]['.$onlineId.'][version][swapContent]=1',t3lib_div::linkThisScript(array('id'=>$onlineId))).'">'.
01721 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/insert2.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).'" />'.
01722 '<b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap',1).'</b></a>';
01723 }
01724
01725
01726 return '
01727
01728 <!--
01729 Version selector:
01730 -->
01731 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
01732 <tr>
01733 <td>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.selVer',1).'</td>
01734 <td>
01735 <select onchange="'.htmlspecialchars($onChange).'">
01736 '.implode('',$opt).'
01737 </select></td>
01738 <td>'.$controls.'</td>
01739 </tr>
01740 </table>
01741 ';
01742 }
01743 }
01744 }
01745 }
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01761 class bigDoc extends template {
01762 var $divClass = 'typo3-bigDoc';
01763 }
01764
01770 class noDoc extends template {
01771 var $divClass = 'typo3-noDoc';
01772 }
01773
01779 class smallDoc extends template {
01780 var $divClass = 'typo3-smallDoc';
01781 }
01782
01788 class mediumDoc extends template {
01789 var $divClass = 'typo3-mediumDoc';
01790 }
01791
01792
01793
01794
01795 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']) {
01796 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']);
01797 }
01798
01799
01800
01801
01802
01803
01804 require_once(PATH_typo3.'sysext/lang/lang.php');
01805 $LANG = t3lib_div::makeInstance('language');
01806 $LANG->init($BE_USER->uc['lang']);
01807
01808
01809
01810
01811
01812
01813 $TBE_TEMPLATE = t3lib_div::makeInstance('template');
01814 ?>