2 /***************************************************************
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Contains class with layout/output function for TYPO3 Backend Scripts
31 * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
32 * XHTML-trans compliant
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
37 * [CLASS/FUNCTION INDEX of SCRIPT]
39 * 145: function fw($str)
43 * 224: function template()
45 * SECTION: EVALUATION FUNCTIONS
46 * 298: function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE)
47 * 315: function viewPageIcon($id,$backPath,$addParams='hspace="3"')
48 * 341: function issueCommand($params,$rUrl='')
49 * 356: function isCMlayers()
50 * 366: function thisBlur()
51 * 376: function helpStyle()
52 * 393: function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('',''))
53 * 419: function getFileheader($title,$path,$iconfile)
54 * 434: function makeShortcutIcon($gvList,$setList,$modName,$motherModName="")
55 * 467: function makeShortcutUrl($gvList,$setList)
56 * 488: function formWidth($size=48,$textarea=0,$styleOverride='')
57 * 513: function formWidthText($size=48,$styleOverride='',$wrap='')
58 * 530: function redirectUrls($thisLocation='')
59 * 554: function formatTime($tstamp,$type)
60 * 571: function parseTime()
62 * SECTION: PAGE BUILDING FUNCTIONS.
63 * 604: function startPage($title)
64 * 686: function endPage()
65 * 720: function header($text)
66 * 741: function section($label,$text,$nostrtoupper=FALSE,$sH=FALSE,$type=0,$allowHTMLinHeader=FALSE)
67 * 765: function divider($dist)
68 * 781: function spacer($dist)
69 * 800: function sectionHeader($label,$sH=FALSE,$addAttrib='')
70 * 817: function sectionBegin()
71 * 838: function sectionEnd()
72 * 858: function middle()
73 * 867: function endPageJS()
74 * 884: function docBodyTagBegin()
75 * 894: function docStyle()
76 * 936: function insertStylesAndJS($content)
77 * 956: function initCharset()
78 * 968: function generator()
80 * SECTION: OTHER ELEMENTS
81 * 1001: function icons($type, $styleAttribValue='')
82 * 1030: function t3Button($onClick,$label)
83 * 1041: function dfw($string)
84 * 1051: function rfw($string)
85 * 1061: function wrapInCData($string)
86 * 1078: function wrapScriptTags($string, $linebreak=TRUE)
87 * 1117: function table($arr, $layout='')
88 * 1159: function menuTable($arr1,$arr2=array(), $arr3=array())
89 * 1192: function funcMenu($content,$menu)
90 * 1210: function clearCacheMenu($id,$addSaveOptions=0)
91 * 1246: function getContextMenuCode()
92 * 1251: function showClickmenu(table, uid, listFr, enDisItems, backPath, addParams)
93 * 1280: function showClickmenu_noajax(url)
94 * 1287: function showClickmenu_ajax(t3ajax)
95 * 1472: function getDragDropCode($table)
96 * 1483: function cancelDragEvent(event)
97 * 1496: function mouseMoveEvent (event)
98 * 1509: function dragElement(id,elementID)
99 * 1528: function dropElement(id)
100 * 1577: function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='')
101 * 1607: function getTabMenuRaw($menuItems)
102 * 1676: function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1)
103 * 1801: function getDynTabMenuJScode()
104 * 1892: function getVersionSelector($id,$noAction=FALSE)
107 * 2060: class bigDoc extends template
110 * 2069: class noDoc extends template
113 * 2078: class smallDoc extends template
116 * 2087: class mediumDoc extends template
118 * TOTAL FUNCTIONS: 57
119 * (This index is automatically created/updated by the extension "extdeveval")
125 if (!defined('TYPO3_MODE')) die("Can't include this file directly.");
127 require_once(PATH_t3lib
.'class.t3lib_ajax.php');
139 * Deprecated fontwrap function. Is just transparent now.
141 * @param string Input string
142 * @return string Output string (in the old days this was wrapped in <font> tags)
151 * TYPO3 Backend Template Class
153 * This class contains functions for starting and ending the HTML of backend modules
154 * It also contains methods for outputting sections of content.
155 * Further there are functions for making icons, links, setting form-field widths etc.
156 * Color scheme and stylesheet definitions are also available here.
157 * Finally this file includes the language class for TYPO3's backend.
159 * After this file $LANG and $TBE_TEMPLATE are global variables / instances of their respective classes.
160 * This file is typically included right after the init.php file,
161 * if language and layout is needed.
163 * Please refer to Inside TYPO3 for a discussion of how to use this API.
165 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
171 // Vars you typically might want to/should set from outside after making instance of this class:
172 var $backPath = ''; // 'backPath' pointing back to the PATH_typo3
173 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.
174 var $JScode=''; // Additional header code (eg. a JavaScript section) could be accommulated in this var. It will be directly outputted in the header.
175 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.
176 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.
177 var $docType = ''; // Doc-type used in the header. Default is HTML 4. You can also set it to 'strict', 'xhtml_trans', or 'xhtml_frames'.
179 // Other vars you can change, but less frequently used:
180 var $scriptID=''; // Script ID.
181 var $bodyTagId=''; // Id which can be set for the body tag. Default value is based on script ID
182 var $bodyTagAdditions=''; // You can add additional attributes to the body-tag through this variable.
183 var $inDocStyles=''; // Additional CSS styles which will be added to the <style> section in the header
184 var $inDocStylesArray=array(); // Like $inDocStyles but for use as array with associative keys to prevent double inclusion of css code
185 var $form_rowsToStylewidth = 9.58; // Multiplication factor for formWidth() input size (default is 48* this value).
186 var $form_largeComp = 1.33; // Compensation for large documents (used in class.t3lib_tceforms.php)
187 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.
189 // TYPO3 Colorscheme.
190 // If you want to change this, please do so through a skin using the global var $TBE_STYLES
191 var $bgColor = '#F7F3EF'; // Light background color
192 var $bgColor2 = '#9BA1A8'; // Steel-blue
193 var $bgColor3 = '#F6F2E6'; // dok.color
194 var $bgColor4 = '#D9D5C9'; // light tablerow background, brownish
195 var $bgColor5 = '#ABBBB4'; // light tablerow background, greenish
196 var $bgColor6 = '#E7DBA8'; // light tablerow background, yellowish, for section headers. Light.
197 var $hoverColor = '#254D7B';
198 var $styleSheetFile = 'stylesheet.css'; // Filename of stylesheet (relative to PATH_typo3)
199 var $styleSheetFile2 = ''; // Filename of stylesheet #2 - linked to right after the $this->styleSheetFile script (relative to PATH_typo3)
200 var $styleSheetFile_post = ''; // Filename of a post-stylesheet - included right after all inline styles.
201 var $backGroundImage = ''; // Background image of page (relative to PATH_typo3)
202 var $inDocStyles_TBEstyle = ''; // Inline css styling set from TBE_STYLES array
205 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.
208 var $charset = 'iso-8859-1'; // Default charset. see function initCharset()
210 var $sectionFlag=0; // Internal: Indicates if a <div>-output section is open
211 var $divClass = ''; // (Default) Class for wrapping <DIV>-tag of page. Is set in class extensions.
220 * Imports relevant parts from global $TBE_STYLES (colorscheme)
224 function template() {
227 // Setting default scriptID:
228 $this->scriptID
= ereg_replace('^.*\/(sysext|ext)\/','ext/',substr(PATH_thisScript
,strlen(PATH_site
)));
229 if (TYPO3_mainDir
!='typo3/' && substr($this->scriptID
,0,strlen(TYPO3_mainDir
)) == TYPO3_mainDir
) {
230 $this->scriptID
= 'typo3/'.substr($this->scriptID
,strlen(TYPO3_mainDir
)); // This fixes if TYPO3_mainDir has been changed so the script ids are STILL "typo3/..."
233 $this->bodyTagId
= ereg_replace('[^[:alnum:]-]','-',$this->scriptID
);
235 // Individual configuration per script? If so, make a recursive merge of the arrays:
236 if (is_array($TBE_STYLES['scriptIDindex'][$this->scriptID
])) {
237 $ovr = $TBE_STYLES['scriptIDindex'][$this->scriptID
]; // Make copy
238 $TBE_STYLES = t3lib_div
::array_merge_recursive_overrule($TBE_STYLES,$ovr); // merge styles.
239 unset($TBE_STYLES['scriptIDindex'][$this->scriptID
]); // Have to unset - otherwise the second instantiation will do it again!
243 if ($TBE_STYLES['mainColors']['bgColor']) $this->bgColor
=$TBE_STYLES['mainColors']['bgColor'];
244 if ($TBE_STYLES['mainColors']['bgColor1']) $this->bgColor1
=$TBE_STYLES['mainColors']['bgColor1'];
245 if ($TBE_STYLES['mainColors']['bgColor2']) $this->bgColor2
=$TBE_STYLES['mainColors']['bgColor2'];
246 if ($TBE_STYLES['mainColors']['bgColor3']) $this->bgColor3
=$TBE_STYLES['mainColors']['bgColor3'];
247 if ($TBE_STYLES['mainColors']['bgColor4']) $this->bgColor4
=$TBE_STYLES['mainColors']['bgColor4'];
248 if ($TBE_STYLES['mainColors']['bgColor5']) $this->bgColor5
=$TBE_STYLES['mainColors']['bgColor5'];
249 if ($TBE_STYLES['mainColors']['bgColor6']) $this->bgColor6
=$TBE_STYLES['mainColors']['bgColor6'];
250 if ($TBE_STYLES['mainColors']['hoverColor']) $this->hoverColor
=$TBE_STYLES['mainColors']['hoverColor'];
253 if ($TBE_STYLES['stylesheet']) $this->styleSheetFile
= $TBE_STYLES['stylesheet'];
254 if ($TBE_STYLES['stylesheet2']) $this->styleSheetFile2
= $TBE_STYLES['stylesheet2'];
255 if ($TBE_STYLES['styleSheetFile_post']) $this->styleSheetFile_post
= $TBE_STYLES['styleSheetFile_post'];
256 if ($TBE_STYLES['inDocStyles_TBEstyle']) $this->inDocStyles_TBEstyle
= $TBE_STYLES['inDocStyles_TBEstyle'];
259 if ($TBE_STYLES['background']) $this->backGroundImage
= $TBE_STYLES['background'];
277 /*****************************************
279 * EVALUATION FUNCTIONS
280 * Various centralized processing
282 *****************************************/
285 * Makes click menu link (context sensitive menu)
286 * Returns $str (possibly an <|img> tag/icon) wrapped in a link which will activate the context sensitive menu for the record ($table/$uid) or file ($table = file)
287 * The link will load the top frame with the parameter "&item" which is the table,uid and listFr arguments imploded by "|": rawurlencode($table.'|'.$uid.'|'.$listFr)
289 * @param string String to be wrapped in link, typ. image tag.
290 * @param string Table name/File path. If the icon is for a database record, enter the tablename from $TCA. If a file then enter the absolute filepath
291 * @param integer If icon is for database record this is the UID for the record from $table
292 * @param boolean Tells the top frame script that the link is coming from a "list" frame which means a frame from within the backend content frame.
293 * @param string Additional GET parameters for the link to alt_clickmenu.php
294 * @param string Enable / Disable click menu items. Example: "+new,view" will display ONLY these two items (and any spacers in between), "new,view" will display all BUT these two items.
295 * @param boolean If set, will return only the onclick JavaScript, not the whole link.
296 * @return string The link-wrapped input string.
298 function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1,$addParams='',$enDisItems='', $returnOnClick=FALSE
) {
299 $backPath = rawurlencode($this->backPath
).'|'.t3lib_div
::shortMD5($this->backPath
.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
300 $onClick = 'showClickmenu("'.$table.'","'.$uid.'","'.$listFr.'","'.$enDisItems.'","'.str_replace('&','&',addcslashes($backPath,'"')).'","'.str_replace('&','&',addcslashes($addParams,'"')).'");return false;';
301 return $returnOnClick ?
$onClick : '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'] ?
' oncontextmenu="'.htmlspecialchars($onClick).'"' : '').'>'.$str.'</a>';
305 * Makes link to page $id in frontend (view page)
306 * Returns an magnifier-glass icon which links to the frontend index.php document for viewing the page with id $id
307 * $id must be a page-uid
308 * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url)
310 * @param integer The page id
311 * @param string The current "BACK_PATH" (the back relative to the typo3/ directory)
312 * @param string Additional parameters for the image tag(s)
313 * @return string HTML string with linked icon(s)
315 function viewPageIcon($id,$backPath,$addParams='hspace="3"') {
318 // If access to Web>List for user, then link to that module.
319 if ($BE_USER->check('modules','web_list')) {
320 $href=$backPath.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'));
321 $str.= '<a href="'.htmlspecialchars($href).'">'.
322 '<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="" />'.
325 // Make link to view page
326 $str.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc
::viewOnClick($id,$backPath,t3lib_BEfunc
::BEgetRootLine($id))).'">'.
327 '<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="" />'.
333 * Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
334 * See description of the API elsewhere.
336 * @param string $params is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World"
337 * @param string Redirect URL if any other that t3lib_div::getIndpEnv('REQUEST_URI') is wished
338 * @return string URL to tce_db.php + parameters (backpath is taken from $this->backPath)
339 * @see t3lib_BEfunc::editOnClick()
341 function issueCommand($params,$rUrl='') {
342 $rUrl = $rUrl ?
$rUrl : t3lib_div
::getIndpEnv('REQUEST_URI');
343 return $this->backPath
.'tce_db.php?'.
345 '&redirect='.($rUrl==-1?
"'+T3_THIS_LOCATION+'":rawurlencode($rUrl)).
346 '&vC='.rawurlencode($GLOBALS['BE_USER']->veriCode()).
351 * Returns true if click-menu layers can be displayed for the current user/browser
352 * Use this to test if click-menus (context sensitive menus) can and should be displayed in the backend.
356 function isCMlayers() {
357 return !$GLOBALS['BE_USER']->uc
['disableCMlayers'] && $GLOBALS['CLIENT']['FORMSTYLE'] && !($GLOBALS['CLIENT']['SYSTEM']=='mac' && $GLOBALS['CLIENT']['BROWSER']=='Opera');
361 * Returns 'this.blur();' if the client supports CSS styles
362 * Use this in links to remove the underlining after being clicked
366 function thisBlur() {
367 return ($GLOBALS['CLIENT']['FORMSTYLE']?
'this.blur();':'');
371 * Returns ' style='cursor:help;'' if the client supports CSS styles
372 * Use for <a>-links to help texts
376 function helpStyle() {
377 return $GLOBALS['CLIENT']['FORMSTYLE'] ?
' style="cursor:help;"':'';
381 * Makes the header (icon+title) for a page (or other record). Used in most modules under Web>*
382 * $table and $row must be a tablename/record from that table
383 * $path will be shown as alt-text for the icon.
384 * The title will be truncated to 45 chars.
386 * @param string Table name
387 * @param array Record row
388 * @param string Alt text
389 * @param boolean Set $noViewPageIcon true if you don't want a magnifier-icon for viewing the page in the frontend
390 * @param array $tWrap is an array with indexes 0 and 1 each representing HTML-tags (start/end) which will wrap the title
391 * @return string HTML content
393 function getHeader($table,$row,$path,$noViewPageIcon=0,$tWrap=array('','')) {
395 if (is_array($row) && $row['uid']) {
396 $iconImgTag=t3lib_iconWorks
::getIconImage($table,$row,$this->backPath
,'title="'.htmlspecialchars($path).'"');
397 $title= strip_tags($row[$TCA[$table]['ctrl']['label']]);
398 $viewPage = $noViewPageIcon ?
'' : $this->viewPageIcon($row['uid'],$this->backPath
,'');
399 if ($table=='pages') $path.=' - '.t3lib_BEfunc
::titleAttribForPages($row,'',0);
401 $iconImgTag='<img'.t3lib_iconWorks
::skinImg($this->backPath
,'gfx/i/_icon_website.gif',$wHattribs='width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />';
402 $title=$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
405 return '<span class="typo3-moduleHeader">'.$this->wrapClickMenuOnIcon($iconImgTag,$table,$row['uid']).
407 $tWrap[0].htmlspecialchars(t3lib_div
::fixed_lgd_cs($title,45)).$tWrap[1].'</span>';
411 * Like ->getHeader() but for files in the File>* main module/submodules
412 * Returns the file-icon with the path of the file set in the alt/title attribute. Shows the file-name after the icon.
414 * @param string Title string, expected to be the filepath
415 * @param string Alt text
416 * @param string The icon file (relative to TYPO3 dir)
417 * @return string HTML content
419 function getFileheader($title,$path,$iconfile) {
420 $fileInfo = t3lib_div
::split_fileref($title);
421 $title = htmlspecialchars(t3lib_div
::fixed_lgd_cs($fileInfo['path'],-35)).'<b>'.htmlspecialchars($fileInfo['file']).'</b>';
422 return '<span class="typo3-moduleHeader"><img'.t3lib_iconWorks
::skinImg($this->backPath
,$iconfile,'width="18" height="16"').' title="'.htmlspecialchars($path).'" alt="" />'.$title.'</span>';
426 * Returns a linked shortcut-icon which will call the shortcut frame and set a shortcut there back to the calling page/module
428 * @param string Is the list of GET variables to store (if any)
429 * @param string Is the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
430 * @param string Module name string
431 * @param string Is used to enter the "parent module name" if the module is a submodule under eg. Web>* or File>*. You can also set this value to "1" in which case the currentLoadedModule is sent to the shortcut script (so - not a fixed value!) - that is used in file_edit.php and wizard_rte.php scripts where those scripts are really running as a part of another module.
432 * @return string HTML content
434 function makeShortcutIcon($gvList,$setList,$modName,$motherModName="") {
435 $backPath=$this->backPath
;
436 $storeUrl=$this->makeShortcutUrl($gvList,$setList);
437 $pathInfo = parse_url(t3lib_div
::getIndpEnv('REQUEST_URI'));
439 if (!strcmp($motherModName,'1')) {
440 $mMN="&motherModName='+top.currentModuleLoaded+'";
441 } elseif ($motherModName) {
442 $mMN='&motherModName='.rawurlencode($motherModName);
445 $onClick = 'if (top.shortcutFrame && confirm('.
446 $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut')).
447 ')){top.shortcutFrame.location.href=\''.$backPath.'alt_shortcut.php?modName='.rawurlencode($modName).
448 '&URL='.rawurlencode($pathInfo['path']."?".$storeUrl).
452 $sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'">
453 <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>';
458 * MAKE url for storing
461 * @param string Is the list of GET variables to store (if any)
462 * @param string Is the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
465 * @see makeShortcutIcon()
467 function makeShortcutUrl($gvList,$setList) {
468 $GET = t3lib_div
::_GET();
469 $storeArray = array_merge(
470 t3lib_div
::compileSelectedGetVarsFromArray($gvList,$GET),
471 array('SET'=>t3lib_div
::compileSelectedGetVarsFromArray($setList,$GLOBALS['SOBE']->MOD_SETTINGS
))
473 $storeUrl = t3lib_div
::implodeArrayForUrl('',$storeArray);
478 * Returns <input> attributes to set the width of an text-type input field.
479 * For client browsers with no CSS support the cols/size attribute is returned.
480 * For CSS compliant browsers (recommended) a ' style="width: ...px;"' is returned.
482 * @param integer A relative number which multiplied with approx. 10 will lead to the width in pixels
483 * @param boolean A flag you can set for textareas - DEPRECATED, use ->formWidthText() for textareas!!!
484 * @param string A string which will be returned as attribute-value for style="" instead of the calculated width (if CSS is enabled)
485 * @return string Tag attributes for an <input> tag (regarding width)
486 * @see formWidthText()
488 function formWidth($size=48,$textarea=0,$styleOverride='') {
489 $wAttrib = $textarea?
'cols':'size';
490 if (!$GLOBALS['CLIENT']['FORMSTYLE']) { // If not setting the width by style-attribute
492 $retVal = ' '.$wAttrib.'="'.$size.'"';
493 } else { // Setting width by style-attribute. 'cols' MUST be avoided with NN6+
494 $pixels = ceil($size*$this->form_rowsToStylewidth
);
495 $retVal = $styleOverride ?
' style="'.$styleOverride.'"' : ' style="width:'.$pixels.'px;"';
501 * This function is dedicated to textareas, which has the wrapping on/off option to observe.
503 * <textarea rows="10" wrap="off" '.$GLOBALS["TBE_TEMPLATE"]->formWidthText(48,"","off").'>
505 * <textarea rows="10" wrap="virtual" '.$GLOBALS["TBE_TEMPLATE"]->formWidthText(48,"","virtual").'>
507 * @param integer A relative number which multiplied with approx. 10 will lead to the width in pixels
508 * @param string A string which will be returned as attribute-value for style="" instead of the calculated width (if CSS is enabled)
509 * @param string Pass on the wrap-attribute value you use in your <textarea>! This will be used to make sure that some browsers will detect wrapping alright.
510 * @return string Tag attributes for an <input> tag (regarding width)
513 function formWidthText($size=48,$styleOverride='',$wrap='') {
514 $wTags = $this->formWidth($size,1,$styleOverride);
515 // 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...
516 if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) {
517 $wTags.=' cols="'.$size.'"';
523 * Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page.
524 * Used in fx. db_list.php (Web>List)
526 * @param string URL to "this location" / current script
528 * @see typo3/db_list.php
530 function redirectUrls($thisLocation='') {
531 $thisLocation = $thisLocation?
$thisLocation:t3lib_div
::linkThisScript(
540 var T3_RETURN_URL = '".str_replace('%20','',rawurlencode(t3lib_div
::_GP('returnUrl')))."';
541 var T3_THIS_LOCATION = '".str_replace('%20','',rawurlencode($thisLocation))."';
547 * Returns a formatted string of $tstamp
548 * Uses $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] and $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] to format date and time
550 * @param integer UNIX timestamp, seconds since 1970
551 * @param integer How much data to show: $type = 1: hhmm, $type = 10: ddmmmyy
552 * @return string Formatted timestamp
554 function formatTime($tstamp,$type) {
557 case 1: $dateStr = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$tstamp);
559 case 10: $dateStr = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp);
566 * Returns script parsetime IF ->parseTimeFlag is set and user is "admin"
567 * Automatically outputted in page end
571 function parseTime() {
572 if ($this->parseTimeFlag
&& $GLOBALS['BE_USER']->isAdmin()) {
573 return '<p>(ParseTime: '.(t3lib_div
::milliseconds()-$GLOBALS['PARSETIME_START']).' ms</p>
574 <p>REQUEST_URI-length: '.strlen(t3lib_div
::getIndpEnv('REQUEST_URI')).')</p>';
589 /*****************************************
591 * PAGE BUILDING FUNCTIONS.
592 * Use this to build the HTML of your backend modules
594 *****************************************/
598 * This includes the proper header with charset, title, meta tag and beginning body-tag.
600 * @param string HTML Page title for the header
601 * @return string Returns the whole header section of a HTML-document based on settings in internal variables (like styles, javascript code, charset, generator and docType)
604 function startPage($title) {
605 // Get META tag containing the currently selected charset for backend output. The function sets $this->charSet.
606 $charSet = $this->initCharset();
607 $generator = $this->generator();
609 // For debugging: If this outputs "QuirksMode"/"BackCompat" (IE) the browser runs in quirks-mode. Otherwise the value is "CSS1Compat"
610 # $this->JScodeArray[]='alert(document.compatMode);';
612 // Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003
613 header ('Content-Type:text/html;charset='.$this->charset
);
615 switch($this->docType
) {
617 $headerStart= '<!DOCTYPE html
618 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
619 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
620 <?xml version="1.0" encoding="'.$this->charset
.'"?>
621 <?xml-stylesheet href="#internalStyle" type="text/css"?>
625 $headerStart= '<!DOCTYPE html
626 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
627 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
628 <?xml version="1.0" encoding="'.$this->charset
.'"?>
629 <?xml-stylesheet href="#internalStyle" type="text/css"?>
633 $headerStart= '<!DOCTYPE html
634 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
635 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
636 <?xml version="1.0" encoding="'.$this->charset
.'"?>
640 $headerStart='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
645 if (!$GLOBALS['BE_USER']->uc
['disableTabInTextarea']) {
646 // This loads the tabulator-in-textarea feature. It automatically modifies every textarea which is found.
647 $tabJScode = '<script src="'.$this->backPath
.'tab.js" type="text/javascript"></script>';
650 // Construct page header.
651 $str = $headerStart.'
654 <!-- TYPO3 Script ID: '.htmlspecialchars($this->scriptID
).' -->
657 <title>'.htmlspecialchars($title).'</title>
658 '.$this->docStyle().'
661 '.$this->wrapScriptTags(implode("\n", $this->JScodeArray
)).'
662 <!--###POSTJSMARKER###-->
666 $this->JScodeArray
=array();
668 if ($this->docType
=='xhtml_frames') {
671 $str.=$this->docBodyTagBegin().
674 <!-- Wrapping DIV-section for whole page BEGIN -->
675 <div class="'.$this->divClass
.'">
676 ':'').trim($this->form
);
681 * Returns page end; This includes finishing form, div, body and html tags.
683 * @return string The HTML end of a page
687 $str = $this->sectionEnd().
690 t3lib_BEfunc
::getSetUpdateSignal().
695 if ($this->docType
!='xhtml_frames') {
697 $str .= ($this->divClass?
'
699 <!-- Wrapping DIV-section for whole page END -->
707 // Logging: Can't find better place to put it:
708 if (TYPO3_DLOG
) t3lib_div
::devLog('END of BACKEND session','',0,array('_FLUSH'=>TRUE
));
714 * Returns the header-bar in the top of most backend modules
715 * Closes section if open.
717 * @param string The text string for the header
718 * @return string HTML content
720 function header($text) {
723 <!-- MAIN Header in page top -->
724 <h2>'.htmlspecialchars($text).'</h2>
726 return $this->sectionEnd().$str;
730 * Begins an output section and sets header and content
732 * @param string The header
733 * @param string The HTML-content
734 * @param boolean A flag that will prevent the header from being converted to uppercase
735 * @param boolean Defines the type of header (if set, "<h3>" rather than the default "h4")
736 * @param integer The number of an icon to show with the header (see the icon-function). -1,1,2,3
737 * @param boolean If set, HTML tags are allowed in $label (otherwise this value is by default htmlspecialchars()'ed)
738 * @return string HTML content
739 * @see icons(), sectionHeader()
741 function section($label,$text,$nostrtoupper=FALSE
,$sH=FALSE
,$type=0,$allowHTMLinHeader=FALSE
) {
746 if (!$allowHTMLinHeader) $label = htmlspecialchars($label);
747 $str.=$this->sectionHeader($this->icons($type).$label, $sH, $nostrtoupper ?
'' : ' class="uppercase"');
752 <!-- Section content -->
755 return $this->sectionBegin().$str;
759 * Inserts a divider image
760 * Ends a section (if open) before inserting the image
762 * @param integer The margin-top/-bottom of the <hr> ruler.
763 * @return string HTML content
765 function divider($dist) {
766 $dist = intval($dist);
770 <hr style="margin-top: '.$dist.'px; margin-bottom: '.$dist.'px;" />
772 return $this->sectionEnd().$str;
776 * Returns a blank <div>-section with a height
778 * @param integer Padding-top for the div-section (should be margin-top but konqueror (3.1) doesn't like it :-(
779 * @return string HTML content
781 function spacer($dist) {
785 <!-- Spacer element -->
786 <div style="padding-top: '.intval($dist).'px;"></div>
792 * Make a section header.
793 * Begins a section if not already open.
795 * @param string The label between the <h3> or <h4> tags. (Allows HTML)
796 * @param boolean If set, <h3> is used, otherwise <h4>
797 * @param string Additional attributes to h-tag, eg. ' class=""'
798 * @return string HTML content
800 function sectionHeader($label,$sH=FALSE
,$addAttrib='') {
801 $tag = ($sH?
'h3':'h4');
804 <!-- Section header -->
805 <'.$tag.$addAttrib.'>'.$label.'</'.$tag.'>
807 return $this->sectionBegin().$str;
811 * Begins an output section.
812 * Returns the <div>-begin tag AND sets the ->sectionFlag true (if the ->sectionFlag is not already set!)
813 * You can call this function even if a section is already begun since the function will only return something if the sectionFlag is not already set!
815 * @return string HTML content
817 function sectionBegin() {
818 if (!$this->sectionFlag
) {
819 $this->sectionFlag
=1;
822 <!-- ***********************
823 Begin output section.
824 *********************** -->
832 * Ends and output section
833 * Returns the </div>-end tag AND clears the ->sectionFlag (but does so only IF the sectionFlag is set - that is a section is 'open')
834 * See sectionBegin() also.
836 * @return string HTML content
838 function sectionEnd() {
839 if ($this->sectionFlag
) {
840 $this->sectionFlag
=0;
843 <!-- *********************
845 ********************* -->
851 * Originally it printed a kind of divider.
852 * Deprecated. Just remove function calls to it or call the divider() function instead.
862 * If a form-tag is defined in ->form then and end-tag for that <form> element is outputted
863 * Further a JavaScript section is outputted which will update the top.busy session-expiry object (unless $this->endJS is set to false)
865 * @return string HTML content (<script> tag section)
867 function endPageJS() {
868 return ($this->endJS?
'
869 <script type="text/javascript">
871 if (top.busy && top.busy.loginRefreshed) {
872 top.busy.loginRefreshed();
879 * Creates the bodyTag.
880 * You can add to the bodyTag by $this->bodyTagAdditions
882 * @return string HTML body tag
884 function docBodyTagBegin() {
885 $bodyContent = 'body '.trim($this->bodyTagAdditions
.($this->bodyTagId ?
' id="'.$this->bodyTagId
.'"' : ''));
886 return '<'.trim($bodyContent).'>';
890 * Outputting document style
892 * @return string HTML style section/link tags
894 function docStyle() {
896 // Request background image:
897 if ($this->backGroundImage
) {
898 $this->inDocStylesArray
[]=' BODY { background-image: url('.$this->backPath
.$this->backGroundImage
.'); }';
901 // Add inDoc styles variables as well:
902 $this->inDocStylesArray
[] = $this->inDocStyles
;
903 $this->inDocStylesArray
[] = $this->inDocStyles_TBEstyle
;
906 $inDocStyles = implode('
907 ',$this->inDocStylesArray
);
909 // The default color scheme should also in full be represented in the stylesheet.
911 '.($this->styleSheetFile?
'<link rel="stylesheet" type="text/css" href="'.$this->backPath
.$this->styleSheetFile
.'" />':'').'
912 '.($this->styleSheetFile2?
'<link rel="stylesheet" type="text/css" href="'.$this->backPath
.$this->styleSheetFile2
.'" />':'').'
913 <style type="text/css" id="internalStyle">
915 '.trim($inDocStyles).'
916 /*###POSTCSSMARKER###*/
919 '.($this->styleSheetFile_post?
'<link rel="stylesheet" type="text/css" href="'.$this->backPath
.$this->styleSheetFile_post
.'" />':'')
922 $this->inDocStyles
='';
923 $this->inDocStylesArray
=array();
930 * Insert post rendering document style into already rendered content
931 * This is needed for extobjbase
933 * @param string style-content to insert.
934 * @return string content with inserted styles
936 function insertStylesAndJS($content) {
937 // insert accumulated CSS
938 $this->inDocStylesArray
[] = $this->inDocStyles
;
939 $styles = "\n".implode("\n", $this->inDocStylesArray
);
940 $content = str_replace('/*###POSTCSSMARKER###*/',$styles,$content);
942 // insert accumulated JS
943 $jscode = $this->JScode
."\n".$this->wrapScriptTags(implode("\n", $this->JScodeArray
));
944 $content = str_replace('<!--###POSTJSMARKER###-->',$jscode,$content);
950 * Initialize the charset.
951 * Sets the internal $this->charset variable to the charset defined in $GLOBALS["LANG"] (or the default as set in this class)
952 * Returns the meta-tag for the document header
954 * @return string <meta> tag with charset from $this->charset or $GLOBALS['LANG']->charSet
956 function initCharset() {
957 // Set charset to the charset provided by the current backend users language selection:
958 $this->charset
= $GLOBALS['LANG']->charSet ?
$GLOBALS['LANG']->charSet
: $this->charset
;
960 return '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset
.'" />';
964 * Returns generator meta tag
966 * @return string <meta> tag with name "generator"
968 function generator() {
969 $str = 'TYPO3 '.TYPO3_branch
.', http://typo3.com, © Kasper Skårhøj 1998-2006, extensions are copyright of their respective owners.';
970 return '<meta name="generator" content="'.$str .'" />';
980 /*****************************************
983 * Tables, buttons, formatting dimmed/red strings
985 ******************************************/
989 * Returns an image-tag with an 18x16 icon of the following types:
992 * -1: OK icon (Check-mark)
993 * 1: Notice (Speach-bubble)
994 * 2: Warning (Yellow triangle)
995 * 3: Fatal error (Red stop sign)
997 * @param integer See description
998 * @param string Value for style attribute
999 * @return string HTML image tag (if applicable)
1001 function icons($type, $styleAttribValue='') {
1004 $icon = 'gfx/icon_fatalerror.gif';
1007 $icon = 'gfx/icon_warning.gif';
1010 $icon = 'gfx/icon_note.gif';
1013 $icon = 'gfx/icon_ok.gif';
1019 return '<img'.t3lib_iconWorks
::skinImg($this->backPath
,$icon,'width="18" height="16"').' class="absmiddle"'.($styleAttribValue ?
' style="'.htmlspecialchars($styleAttribValue).'"' : '').' alt="" />';
1024 * Returns an <input> button with the $onClick action and $label
1026 * @param string The value of the onclick attribute of the input tag (submit type)
1027 * @param string The label for the button (which will be htmlspecialchar'ed)
1028 * @return string A <input> tag of the type "submit"
1030 function t3Button($onClick,$label) {
1031 $button = '<input type="submit" onclick="'.htmlspecialchars($onClick).'; return false;" value="'.htmlspecialchars($label).'" />';
1036 * dimmed-fontwrap. Returns the string wrapped in a <span>-tag defining the color to be gray/dimmed
1038 * @param string Input string
1039 * @return string Output string
1041 function dfw($string) {
1042 return '<span class="typo3-dimmed">'.$string.'</span>';
1046 * red-fontwrap. Returns the string wrapped in a <span>-tag defining the color to be red
1048 * @param string Input string
1049 * @return string Output string
1051 function rfw($string) {
1052 return '<span class="typo3-red">'.$string.'</span>';
1056 * Returns string wrapped in CDATA "tags" for XML / XHTML (wrap content of <script> and <style> sections in those!)
1058 * @param string Input string
1059 * @return string Output string
1061 function wrapInCData($string) {
1062 $string = '/*<![CDATA[*/'.
1070 * Wraps the input string in script tags.
1071 * Automatic re-identing of the JS code is done by using the first line as ident reference.
1072 * This is nice for identing JS code with PHP code on the same level.
1074 * @param string Input string
1075 * @param boolean Wrap script element in linebreaks? Default is TRUE.
1076 * @return string Output string
1078 function wrapScriptTags($string, $linebreak=TRUE
) {
1080 // <script wrapped in nl?
1081 $cr = $linebreak?
"\n" : '';
1083 // remove nl from the beginning
1084 $string = preg_replace ('/^\n+/', '', $string);
1085 // re-ident to one tab using the first line as reference
1087 if(preg_match('/^(\t+)/',$string,$match)) {
1088 $string = str_replace($match[1],"\t", $string);
1090 $string = $cr.'<script type="text/javascript">
1096 return trim($string);
1099 // These vars defines the layout for the table produced by the table() function.
1100 // You can override these values from outside if you like.
1101 var $tableLayout = Array (
1103 'defCol' => Array('<td valign="top">','</td>')
1106 var $table_TR = '<tr>';
1107 var $table_TABLE = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-tmpltable">';
1110 * Returns a table based on the input $arr
1112 * @param array Multidim array with first levels = rows, second levels = cells
1113 * @param array If set, then this provides an alternative layout array instead of $this->tableLayout
1114 * @return string The HTML table.
1117 function table($arr, $layout='') {
1118 if (is_array($arr)) {
1119 $tableLayout = (is_array($layout)) ?
$layout : $this->tableLayout
;
1124 while(list(,$val)=each($arr)) {
1126 $layout = is_array($tableLayout['defRowOdd']) ?
$tableLayout['defRowOdd'] : $tableLayout['defRow'];
1128 $layout = is_array($tableLayout['defRowEven']) ?
$tableLayout['defRowEven'] : $tableLayout['defRow'];
1130 $layoutRow = is_array($tableLayout[$rc]) ?
$tableLayout[$rc] : $layout;
1132 if (is_array($val)) {
1134 while(list(,$content)=each($val)) {
1135 $wrap= is_array($layoutRow[$cc]) ?
$layoutRow[$cc] : (is_array($layoutRow['defCol']) ?
$layoutRow['defCol'] : (is_array($layout[$cc]) ?
$layout[$cc] : $layout['defCol']));
1136 $code_td.=$wrap[0].$content.$wrap[1];
1140 $trWrap = is_array($layoutRow['tr']) ?
$layoutRow['tr'] : (is_array($layout['tr']) ?
$layout['tr'] : array($this->table_TR
, '</tr>'));
1141 $code.=$trWrap[0].$code_td.$trWrap[1];
1144 $tableWrap = is_array($tableLayout['table']) ?
$tableLayout['table'] : array($this->table_TABLE
, '</table>');
1145 $code=$tableWrap[0].$code.$tableWrap[1];
1151 * Constructs a table with content from the $arr1, $arr2 and $arr3.
1152 * Used in eg. ext/belog/mod/index.php - refer to that for examples
1154 * @param array Menu elements on first level
1155 * @param array Secondary items
1156 * @param array Third-level items
1157 * @return string HTML content, <table>...</table>
1159 function menuTable($arr1,$arr2=array(), $arr3=array()) {
1160 $rows = max(array(count($arr1),count($arr2),count($arr3)));
1163 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tablemenu">';
1164 for($a=0;$a<$rows;$a++
) {
1168 $cls[]='<td valign="'.$valign.'">'.$arr1[$a][0].'</td><td>'.$arr1[$a][1].'</td>';
1170 $cls[]='<td valign="'.$valign.'">'.$arr2[$a][0].'</td><td>'.$arr2[$a][1].'</td>';
1172 $cls[]='<td valign="'.$valign.'">'.$arr3[$a][0].'</td><td>'.$arr3[$a][1].'</td>';
1175 $menu.=implode($cls,'<td> </td>');
1185 * Returns a one-row/two-celled table with $content and $menu side by side.
1186 * The table is a 100% width table and each cell is aligned left / right
1188 * @param string Content cell content (left)
1189 * @param string Menu cell content (right)
1190 * @return string HTML output
1192 function funcMenu($content,$menu) {
1194 <table border="0" cellpadding="0" cellspacing="0" width="100%" id="typo3-funcmenu">
1196 <td valign="top" nowrap="nowrap">'.$content.'</td>
1197 <td valign="top" align="right" nowrap="nowrap">'.$menu.'</td>
1203 * Creates a selector box with clear-cache items.
1204 * Rather specialized functions - at least don't use it with $addSaveOptions unless you know what you do...
1206 * @param integer The page uid of the "current page" - the one that will be cleared as "clear cache for this page".
1207 * @param boolean If $addSaveOptions is set, then also the array of save-options for TCE_FORMS will appear.
1208 * @return string <select> tag with content - a selector box for clearing the cache
1210 function clearCacheMenu($id,$addSaveOptions=0) {
1213 if ($addSaveOptions) {
1214 $opt[]='<option value="">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.menu',1).'</option>';
1215 $opt[]='<option value="TBE_EDITOR_checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'</option>';
1216 $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>';
1217 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>';
1218 $opt[]='<option value="document.editform.closeDoc.value=2; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'</option>';
1219 $opt[]='<option value="document.editform.closeDoc.value=3; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeAllDocs',1).'</option>';
1220 $opt[]='<option value=""></option>';
1222 $opt[]='<option value="">[ '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_clearCache',1).' ]</option>';
1223 if ($id) $opt[]='<option value="'.$id.'">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_thisPage',1).'</option>';
1224 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>';
1225 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>';
1227 $onChange = 'if (!this.options[this.selectedIndex].value) {
1228 this.selectedIndex=0;
1229 } else if (this.options[this.selectedIndex].value.indexOf(\';\')!=-1) {
1230 eval(this.options[this.selectedIndex].value);
1232 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;
1234 $af_content = '<select name="cacheCmd" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
1236 if (count($opt)>1) {
1242 * Returns an array with parts (JavaScript, init-functions, <div>-layers) for use on pages which displays the clickmenu layers (context sensitive menus)
1244 * @return array If values are present: [0] = A <script> section for the HTML page header, [1] = onmousemove/onload handler for HTML tag or alike, [2] = Two empty <div> layers for the context menu
1246 function getContextMenuCode() {
1248 <script type="text/javascript">
1250 // is called from most clickmenu links
1251 function showClickmenu(table, uid, listFr, enDisItems, backPath, addParams) {
1252 var url = "'.$this->backPath
.'alt_clickmenu.php?table=" + table
1254 + "&listFr=" + listFr
1255 + "&enDisItems=" + enDisItems
1256 + "&backPath=" + backPath
1257 + "&addParams=" + addParams;
1259 showClickmenu_raw(url);
1261 // switch - either forwards call to ajax or does the request in the top frame
1262 function showClickmenu_raw(url) {';
1263 if($this->isCMlayers()) { // ajax
1266 ajax_doRequest(url);';
1269 showClickmenu_noajax(url);';
1275 * [Describe function...]
1277 * @param [type] $url: ...
1278 * @return [type] ...
1280 function showClickmenu_noajax(url) {
1281 top.loadTopMenu(url);
1283 if ($this->isCMlayers()) {
1284 $content .= t3lib_ajax
::getJScode('showClickmenu_ajax', 'showClickmenu_noajax');
1286 // opens the clickmenu, is called from ajax_doRequest
1287 function showClickmenu_ajax(t3ajax) {
1288 if (t3ajax.getElementsByTagName("data")[0]) {
1289 var clickmenu = t3ajax.getElementsByTagName("data")[0].getElementsByTagName("clickmenu")[0];
1290 var tableData = clickmenu.getElementsByTagName("htmltable")[0].firstChild.data;
1291 var cmlevel = clickmenu.getElementsByTagName("cmlevel")[0].firstChild.data;
1292 setLayerObj(tableData,cmlevel);
1297 var GLV_curLayerX=new Array(0,0);
1298 var GLV_curLayerY=new Array(0,0);
1299 var GLV_curLayerWidth=new Array(0,0);
1300 var GLV_curLayerHeight=new Array(0,0);
1301 var GLV_isVisible=new Array(0,0);
1306 var layerObj=new Array();
1307 var layerObjCss=new Array();
1310 function GL_checkBrowser(){ //
1311 this.dom= (document.getElementById);
1312 this.op= (navigator.userAgent.indexOf("Opera")>-1);
1313 this.op7= this.op && (navigator.appVersion.indexOf("7")>-1); // check for Opera version 7
1314 this.konq= (navigator.userAgent.indexOf("Konq")>-1);
1315 this.ie4= (document.all && !this.dom && !this.op && !this.konq);
1316 this.ie5= (document.all && this.dom && !this.op && !this.konq);
1317 this.ns4= (document.layers && !this.dom && !this.konq);
1318 this.ns5= (!document.all && this.dom && !this.op && !this.konq);
1319 this.ns6= (this.ns5);
1320 this.bw= (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.op || this.konq);
1323 bw= new GL_checkBrowser();
1326 function GL_getObj(obj){ //
1328 this.el= (bw.ie4||bw.op7)?document.all[obj]:bw.ns4?eval(nest+"document."+obj):document.getElementById(obj);
1329 this.css= bw.ns4?this.el:this.el.style;
1330 this.ref= bw.ns4?this.el.document:document;
1331 this.x= (bw.ns4||bw.op)?this.css.left:this.el.offsetLeft;
1332 this.y= (bw.ns4||bw.op)?this.css.top:this.el.offsetTop;
1333 this.height= (bw.ie4||bw.dom)?this.el.offsetHeight:bw.ns4?this.ref.height:0;
1334 this.width= (bw.ie4||bw.dom)?this.el.offsetWidth:bw.ns4?this.ref.width:0;
1337 // GL_getObjCss(obj)
1338 function GL_getObjCss(obj){ //
1339 return bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;
1341 // GL_getMouse(event)
1342 function GL_getMouse(event) { //
1344 // GLV_x= (bw.ns4||bw.ns5)?event.pageX:(bw.ie4||bw.op)?event.clientX:(event.clientX-2)+document.body.scrollLeft;
1345 // GLV_y= (bw.ns4||bw.ns5)?event.pageY:(bw.ie4||bw.op)?event.clientY:(event.clientY-2)+document.body.scrollTop;
1346 // 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:
1348 GLV_xRel = event.clientX-2;
1349 GLV_yRel = event.clientY-2;
1350 GLV_x = GLV_xRel + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
1351 GLV_y = GLV_yRel + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
1353 // status = (GLV_x+GLV_gap-GLV_curLayerX[0]) + " | " + (GLV_y+GLV_gap-GLV_curLayerY[0]);
1354 if (GLV_isVisible[1]) {
1355 if (outsideLayer(1)) hideSpecific(1);
1356 } else if (GLV_isVisible[0]) {
1357 if (outsideLayer(0)) hideSpecific(0);
1361 // outsideLayer(level)
1362 function outsideLayer(level) { //
1363 return GLV_x+GLV_gap-GLV_curLayerX[level] <0 ||
1364 GLV_y+GLV_gap-GLV_curLayerY[level] <0 ||
1365 GLV_curLayerX[level]+GLV_curLayerWidth[level]+GLV_gap-GLV_x <0 ||
1366 GLV_curLayerY[level]+GLV_curLayerHeight[level]+GLV_gap-GLV_y <0;
1368 // setLayerObj(html,level)
1369 function setLayerObj(html,level) { //
1370 var winHeight = document.documentElement.clientHeight && !bw.op7 ? document.documentElement.clientHeight : document.body.clientHeight;
1371 var winWidth = document.documentElement.clientWidth && !bw.op7 ? document.documentElement.clientWidth : document.body.clientWidth;
1372 var tempLayerObj = GL_getObj("contentMenu"+level);
1373 var tempLayerObjCss = GL_getObjCss("contentMenu"+level);
1375 if (tempLayerObj && (level==0 || GLV_isVisible[level-1])) {
1376 tempLayerObj.el.innerHTML = html;
1377 tempLayerObj.width= (bw.ie4||bw.dom)?this.el.offsetWidth:bw.ns4?this.ref.width:0;
1378 tempLayerObj.height= (bw.ie4||bw.dom)?this.el.offsetHeight:bw.ns4?this.ref.height:0;
1380 // konqueror (3.2.2) workaround
1381 winHeight = (bw.konq)?window.innerHeight:winHeight;
1382 winWidth = (bw.konq)?window.innerWidth:winWidth;
1384 // Adjusting the Y-height of the layer to fit it into the window frame if it goes under the window frame in the bottom:
1385 if (winHeight-tempLayerObj.height < GLV_yRel) {
1386 if (GLV_yRel < tempLayerObj.height) {
1387 GLV_y+= (winHeight-tempLayerObj.height-GLV_yRel); // Setting it so bottom is just above window height.
1389 GLV_y-= tempLayerObj.height-8; // Showing the menu upwards
1392 // Adjusting the X position like Y above
1393 if (winWidth-tempLayerObj.width < GLV_xRel) {
1394 if (GLV_xRel < tempLayerObj.width) {
1395 GLV_x+= (winWidth-tempLayerObj.width-GLV_xRel);
1397 GLV_x-= tempLayerObj.width-8;
1400 GLV_x = Math.max(GLV_x,1);
1401 GLV_y = Math.max(GLV_y,1);
1403 GLV_curLayerX[level] = GLV_x;
1404 GLV_curLayerY[level] = GLV_y;
1405 tempLayerObjCss.left = GLV_x+"px";
1406 tempLayerObjCss.top = GLV_y+"px";
1407 tempLayerObjCss.visibility = "visible";
1408 if (bw.ie5) showHideSelectorBoxes("hidden");
1410 GLV_isVisible[level]=1;
1411 GLV_curLayerWidth[level] = tempLayerObj.width;
1412 GLV_curLayerHeight[level] = tempLayerObj.height;
1416 function hideEmpty() { //
1421 // hideSpecific(level)
1422 function hideSpecific(level) { //
1423 GL_getObjCss("contentMenu"+level).visibility = "hidden";
1424 GL_getObj("contentMenu"+level).el.innerHTML = "";
1425 GLV_isVisible[level]=0;
1427 if (bw.ie5 && level==0) showHideSelectorBoxes("visible");
1429 // debugObj(obj,name)
1430 function debugObj(obj,name) { //
1432 for (i in obj) {if (obj[i]) {acc+=i+": "+obj[i]+"\n";}}
1433 alert("Object: "+name+"\n\n"+acc);
1436 function initLayer(){ //
1438 window.onmousemove=GL_getMouse;
1440 layerObj = GL_getObj("contentMenu1");
1441 layerObjCss = GL_getObjCss("contentMenu1");
1443 function showHideSelectorBoxes(action) { // This function by Michiel van Leening
1444 for (i=0;i<document.forms.length;i++) {
1445 for (j=0;j<document.forms[i].elements.length;j++) {
1446 if(document.forms[i].elements[j].type=="select-one") {
1447 document.forms[i].elements[j].style.visibility=action;
1456 ' onmousemove="GL_getMouse(event);" onload="initLayer();"',
1457 '<div id="contentMenu0" style="z-index:1; position:absolute;visibility:hidden"></div><div id="contentMenu1" style="z-index:2; position:absolute;visibility:hidden"></div>'
1462 return array($content,'','');
1467 * Returns an array with parts (JavaScript, init-functions, <div>-layers) for use on pages which have the drag and drop functionality (usually pages and folder display trees)
1469 * @param string indicator of which table the drag and drop function should work on (pages or folders)
1470 * @return array If values are present: [0] = A <script> section for the HTML page header, [1] = onmousemove/onload handler for HTML tag or alike, [2] = One empty <div> layer for the follow-mouse drag element
1472 function getDragDropCode($table) {
1474 <script type="text/javascript">
1478 if ($this->isCMlayers()) {
1481 var dragIconCSS = null;
1483 function cancelDragEvent(event) {
1485 dragIconCSS.visibility = "hidden";
1486 document.onmouseup = null;
1487 document.onmousemove = null;
1491 * [Describe function...]
1493 * @param [type] $event: ...
1494 * @return [type] ...
1496 function mouseMoveEvent (event) {
1497 dragIconCSS.left = GLV_x+5+"px";
1498 dragIconCSS.top = GLV_y-5+"px";
1499 dragIconCSS.visibility = "visible";
1504 * [Describe function...]
1506 * @param [type] $id,elementID: ...
1507 * @return [type] ...
1509 function dragElement(id,elementID) {
1511 if (elementID == null) {
1514 document.getElementById("dragIcon").innerHTML=document.getElementById("dragIconID_"+elementID).innerHTML + document.getElementById("dragTitleID_"+elementID).getElementsByTagName("a")[0].innerHTML;
1515 dragIconCSS = new GL_getObjCss("dragIcon");
1516 dragIconCSS.whiteSpace = "nowrap";
1517 document.onmouseup = cancelDragEvent;
1518 document.onmousemove = mouseMoveEvent;
1523 * [Describe function...]
1525 * @param [type] $id: ...
1526 * @return [type] ...
1528 function dropElement(id) {
1529 if ((dragID != null) && (dragID != id)) {
1530 var url = "'.$this->backPath
.'alt_clickmenu.php?dragDrop='.$table.'"
1531 + "&srcId=" + dragID
1533 + "&backPath='.t3lib_div
::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'";
1534 showClickmenu_raw(url);
1543 function dragElement(id) { return false; }
1544 function dropElement(id) { return false; }
1551 if ($this->isCMlayers()) {
1555 '<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>'
1558 return array($content,'','');
1563 * Creates a tab menu from an array definition
1565 * Returns a tab menu for a module
1566 * Requires the JS function jumpToUrl() to be available
1568 * @param mixed $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
1569 * @param string $elementName it the form elements name, probably something like "SET[...]"
1570 * @param string $currentValue is the value to be selected currently.
1571 * @param array $menuItems is an array with the menu items for the selector box
1572 * @param string $script is the script to send the &id to, if empty it's automatically found
1573 * @param string $addParams is additional parameters to pass to the script.
1574 * @return string HTML code for tab menu
1575 * @author Rene Fritz <r.fritz@colorcube.de>
1577 function getTabMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') {
1580 if (is_array($menuItems)) {
1581 if (!is_array($mainParams)) {
1582 $mainParams = array('id' => $mainParams);
1584 $mainParams = t3lib_div
::implodeArrayForUrl('',$mainParams);
1586 if (!$script) {$script=basename(PATH_thisScript
);}
1589 foreach($menuItems as $value => $label) {
1590 $menuDef[$value]['isActive'] = !strcmp($currentValue,$value);
1591 $menuDef[$value]['label'] = t3lib_div
::deHSCentities(htmlspecialchars($label));
1592 $menuDef[$value]['url'] = htmlspecialchars($script.'?'.$mainParams.$addparams.'&'.$elementName.'='.$value);
1594 $content = $this->getTabMenuRaw($menuDef);
1601 * Creates the HTML content for the tab menu
1603 * @param array Menu items for tabs
1604 * @return string Table HTML
1607 function getTabMenuRaw($menuItems) {
1610 if (is_array($menuItems)) {
1613 $count = count($menuItems);
1617 $widthRight = max (1,floor(30-pow($count,1.72)));
1618 $widthTabs = 100 - $widthRight - $widthLeft;
1619 $widthNo = floor(($widthTabs - $addToAct)/$count);
1620 $addToAct = max ($addToAct,$widthTabs-($widthNo*$count));
1621 $widthAct = $widthNo +
$addToAct;
1622 $widthRight = 100 - ($widthLeft +
($count*$widthNo) +
$addToAct);
1625 foreach($menuItems as $id => $def) {
1626 $isActive = $def['isActive'];
1627 $class = $isActive ?
'tabact' : 'tab';
1628 $width = $isActive ?
$widthAct : $widthNo;
1630 // @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.
1631 $label = $def['label'];
1632 $url = htmlspecialchars($def['url']);
1633 $params = $def['addParams'];
1637 <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>';
1640 <td width="'.$width.'%" class="'.$class.'"><a href="'.$url.'" '.$params.'>'.$label.'</a></td>';
1648 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="typo3-tabmenu">
1650 <td width="'.$widthLeft.'%"> </td>
1652 <td width="'.$widthRight.'%"> </td>
1655 <div class="hr" style="margin:0px"></div>';
1663 * Creates a DYNAMIC tab-menu where the tabs are switched between with DHTML.
1664 * Should work in MSIE, Mozilla, Opera and Konqueror. On Konqueror I did find a serious problem: <textarea> fields loose their content when you switch tabs!
1666 * @param array Numeric array where each entry is an array in itself with associative keys: "label" contains the label for the TAB, "content" contains the HTML content that goes into the div-layer of the tabs content. "description" contains description text to be shown in the layer. "linkTitle" is short text for the title attribute of the tab-menu link (mouse-over text of tab). "stateIcon" indicates a standard status icon (see ->icon(), values: -1, 1, 2, 3). "icon" is an image tag placed before the text.
1667 * @param string Identification string. This should be unique for every instance of a dynamic menu!
1668 * @param integer If "1", then enabling one tab does not hide the others - they simply toggles each sheet on/off. This makes most sense together with the $foldout option. If "-1" then it acts normally where only one tab can be active at a time BUT you can click a tab and it will close so you have no active tabs.
1669 * @param boolean If set, the tabs are rendered as headers instead over each sheet. Effectively this means there is no tab menu, but rather a foldout/foldin menu. Make sure to set $toggle as well for this option.
1670 * @param integer Character limit for a new row.
1671 * @param boolean If set, tab table cells are not allowed to wrap their content
1672 * @param boolean If set, the tabs will span the full width of their position
1673 * @param integer Default tab to open (for toggle <=0). Value corresponds to integer-array index + 1 (index zero is "1", index "1" is 2 etc.). A value of zero (or something non-existing) will result in no default tab open.
1674 * @return string JavaScript section for the HTML header.
1676 function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE
,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE
,$defaultTabIndex=1) {
1679 if (is_array($menuItems)) {
1682 $options = array(array());
1685 $id = 'DTM-'.t3lib_div
::shortMD5($identString);
1686 $noWrap = $noWrap ?
' nowrap="nowrap"' : '';
1688 // Traverse menu items
1692 foreach($menuItems as $index => $def) {
1693 $index+
=1; // Need to add one so checking for first index in JavaScript is different than if it is not set at all.
1695 // Switch to next tab row if needed
1696 if (!$foldout && $titleLenCount>$newRowCharLimit) { // 50 characters is probably a reasonable count of characters before switching to next row of tabs.
1699 $options[$tabRows] = array();
1703 $onclick = 'this.blur(); DTM_toggle("'.$id.'","'.$index.'"); return false;';
1705 $onclick = 'this.blur(); DTM_activate("'.$id.'","'.$index.'", '.($toggle<0?
1:0).'); return false;';
1708 $isActive = strcmp($def['content'],'');
1710 $mouseOverOut = 'onmouseover="DTM_mouseOver(this);" onmouseout="DTM_mouseOut(this);"';
1714 $options[$tabRows][] = '
1715 <td class="'.($isActive ?
'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$noWrap.$mouseOverOut.'>'.
1716 ($isActive ?
'<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ?
' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : '').
1718 ($def['label'] ?
htmlspecialchars($def['label']) : ' ').
1719 $this->icons($def['stateIcon'],'margin-left: 10px;').
1720 ($isActive ?
'</a>' :'').
1722 $titleLenCount+
= strlen($def['label']);
1724 // Create DIV layer for content:
1726 <div class="'.($isActive ?
'tab' : 'disabled').'" id="'.$id.'-'.$index.'-MENU"'.$mouseOverOut.'>'.
1727 ($isActive ?
'<a href="#" onclick="'.htmlspecialchars($onclick).'"'.($def['linkTitle'] ?
' title="'.htmlspecialchars($def['linkTitle']).'"':'').'>' : '').
1729 ($def['label'] ?
htmlspecialchars($def['label']) : ' ').
1730 ($isActive ?
'</a>' : '').
1735 // Create DIV layer for content:
1737 <div style="display: none;" id="'.$id.'-'.$index.'-DIV" class="c-tablayer">'.
1738 ($def['description'] ?
'<p class="c-descr">'.nl2br(htmlspecialchars($def['description'])).'</p>' : '').
1741 // Create initialization string:
1743 DTM_array["'.$id.'"]['.$c.'] = "'.$id.'-'.$index.'";
1747 if (top.DTM_currentTabs["'.$id.'-'.$index.'"]) { DTM_toggle("'.$id.'","'.$index.'",1); }
1756 if (count($options)) {
1758 // Tab menu is compiled:
1761 for($a=0;$a<=$tabRows;$a++
) {
1765 <table cellpadding="0" cellspacing="0" border="0"'.($fullWidth ?
' width="100%"' : '').' class="typo3-dyntabmenu">
1767 '.implode('',$options[$a]).'
1771 $content.= '<div class="typo3-dyntabmenu-tabs">'.$tabContent.'</div>';
1774 // Div layers are added:
1776 <!-- Div layers for tab menu: -->
1777 <div class="typo3-dyntabmenu-divs'.($foldout?
'-foldout':'').'">
1778 '.implode('',$divs).'</div>';
1780 // Java Script section added:
1782 <!-- Initialization JavaScript for the menu -->
1783 <script type="text/javascript">
1784 DTM_array["'.$id.'"] = new Array();
1785 '.implode('',$JSinit).'
1786 '.($toggle<=0 ?
'DTM_activate("'.$id.'", top.DTM_currentTabs["'.$id.'"]?top.DTM_currentTabs["'.$id.'"]:'.intval($defaultTabIndex).', 0);' : '').'
1797 * Returns dynamic tab menu header JS code.
1799 * @return string JavaScript section for the HTML header.
1801 function getDynTabMenuJScode() {
1803 <script type="text/javascript">
1805 var DTM_array = new Array();
1806 var DTM_origClass = new String();
1808 // if tabs are used in a popup window the array might not exists
1809 if(!top.DTM_currentTabs) {
1810 top.DTM_currentTabs = new Array();
1813 function DTM_activate(idBase,index,doToogle) { //
1815 if (DTM_array[idBase]) {
1816 for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
1817 if (DTM_array[idBase][cnt] != idBase+"-"+index) {
1818 document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
1819 document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
1825 if (document.getElementById(idBase+"-"+index+"-DIV")) {
1826 if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
1827 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
1828 if(DTM_origClass=="") {
1829 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
1831 DTM_origClass = "tab";
1833 top.DTM_currentTabs[idBase] = -1;
1835 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
1836 if(DTM_origClass=="") {
1837 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
1839 DTM_origClass = "tabact";
1841 top.DTM_currentTabs[idBase] = index;
1845 function DTM_toggle(idBase,index,isInit) { //
1847 if (document.getElementById(idBase+"-"+index+"-DIV")) {
1848 if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
1849 document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
1851 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
1853 DTM_origClass = "tab";
1855 top.DTM_currentTabs[idBase+"-"+index] = 0;
1857 document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
1859 document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
1861 DTM_origClass = "tabact";
1863 top.DTM_currentTabs[idBase+"-"+index] = 1;
1868 function DTM_mouseOver(obj) { //
1869 DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
1870 obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
1873 function DTM_mouseOut(obj) { //
1874 obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
1885 * Creates the version selector for the page id inputted.
1886 * Requires the core version management extension, "version" to be loaded.
1888 * @param integer Page id to create selector for.
1889 * @param boolean If set, there will be no button for swapping page.
1892 function getVersionSelector($id,$noAction=FALSE
) {
1895 if (t3lib_extMgm
::isLoaded('version') && $GLOBALS['BE_USER']->workspace
==0) {
1897 // Get Current page record:
1898 $curPage = t3lib_BEfunc
::getRecord('pages',$id);
1899 // If the selected page is not online, find the right ID
1900 $onlineId = ($curPage['pid']==-1 ?
$curPage['t3ver_oid'] : $id);
1901 // Select all versions of online version:
1902 $versions = t3lib_BEfunc
::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id');
1904 // If more than one was found...:
1905 if (count($versions)>1) {
1907 // Create selector box entries:
1909 foreach($versions as $vRow) {
1910 $opt[] = '<option value="'.htmlspecialchars(t3lib_div
::linkThisScript(array('id'=>$vRow['uid']))).'"'.($id==$vRow['uid']?
' selected="selected"':'').'>'.
1911 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').'<=':'')).
1915 // Add management link:
1916 $opt[] = '<option value="'.htmlspecialchars(t3lib_div
::linkThisScript(array('id'=>$id))).'">---</option>';
1917 $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>';
1919 // Create onchange handler:
1920 $onChange = "window.location.href=this.options[this.selectedIndex].value;";
1923 if ($id==$onlineId) {
1924 $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>';
1925 } elseif (!$noAction) {
1926 $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">'.
1927 '<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).'" />'.
1928 '<b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap',1).'</b></a>';
1931 // Write out HTML code:
1937 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
1939 <td>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.selVer',1).'</td>
1941 <select onchange="'.htmlspecialchars($onChange).'">
1942 '.implode('',$opt).'
1944 <td>'.$controls.'</td>
1949 } elseif ($GLOBALS['BE_USER']->workspace
!==0) {
1951 // Write out HTML code:
1952 switch($GLOBALS['BE_USER']->workspace
) {
1960 $wsTitle = $GLOBALS['BE_USER']->workspaceRec
['title'];
1964 if (t3lib_BEfunc
::isPidInVersionizedBranch($id)=='branchpoint') {
1970 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
1972 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td>
1973 <td><em>Inside branch, no further versioning possible</em></td>
1978 // Get Current page record:
1979 $curPage = t3lib_BEfunc
::getRecord('pages',$id);
1980 // If the selected page is not online, find the right ID
1981 $onlineId = ($curPage['pid']==-1 ?
$curPage['t3ver_oid'] : $id);
1982 // The version of page:
1983 $verPage = t3lib_BEfunc
::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace
, 'pages', $onlineId);
1987 if (!count(t3lib_BEfunc
::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace
, $onlineId))) {
1988 if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) {
1990 $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=new&cmd[pages]['.$onlineId.'][version][treeLevels]=0',t3lib_div
::linkThisScript(array('id'=>$onlineId)));
1991 $onClick = 'window.location.href=\''.$onClick.'\'; return false;';
1992 // Write out HTML code:
1996 No version yet, create one?
1998 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
2000 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td>
2002 <input type="submit" value="New version of page" name="_" onclick="'.htmlspecialchars($onClick).'" /></td>
2013 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
2015 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td>
2016 <td><em>Versions found on page, no "Page" versioning possible</em></td>
2021 } elseif ($verPage['t3ver_swapmode']==0) {
2022 $onClick = $this->issueCommand('&cmd[pages]['.$onlineId.'][version][action]=swap&cmd[pages]['.$onlineId.'][version][swapWith]='.$verPage['uid'],t3lib_div
::linkThisScript(array('id'=>$onlineId)));
2023 $onClick = 'window.location.href=\''.$onClick.'\'; return false;';
2025 // Write out HTML code:
2031 <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
2033 <td>Workspace: "'.htmlspecialchars($wsTitle).'"</td>
2035 <input type="submit" value="Publish page" name="_" onclick="'.htmlspecialchars($onClick).'" /></td>
2048 // ******************************
2049 // Extension classes of the template class.
2050 // These are meant to provide backend screens with different widths.
2051 // They still do because of the different class-prefixes used for the <div>-sections
2052 // but obviously the final width is determined by the stylesheet used.
2053 // ******************************
2056 * Extension class for "template" - used for backend pages which are wide. Typically modules taking up all the space in the "content" frame of the backend
2057 * The class were more significant in the past than today.
2060 class bigDoc
extends template
{
2061 var $divClass = 'typo3-bigDoc';
2065 * Extension class for "template" - used for backend pages without the "document" background image
2066 * The class were more significant in the past than today.
2069 class noDoc
extends template
{
2070 var $divClass = 'typo3-noDoc';
2074 * Extension class for "template" - used for backend pages which were narrow (like the Web>List modules list frame. Or the "Show details" pop up box)
2075 * The class were more significant in the past than today.
2078 class smallDoc
extends template
{
2079 var $divClass = 'typo3-smallDoc';
2083 * Extension class for "template" - used for backend pages which were medium wide. Typically submodules to Web or File which were presented in the list-frame when the content frame were divided into a navigation and list frame.
2084 * The class were more significant in the past than today. But probably you should use this one for most modules you make.
2087 class mediumDoc
extends template
{
2088 var $divClass = 'typo3-mediumDoc';
2093 // Include extension to the template class?
2094 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/template.php']) {
2095 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/template.php']);
2100 // ******************************************************
2101 // The backend language engine is started (ext: "lang")
2102 // ******************************************************
2103 require_once(PATH_typo3
.'sysext/lang/lang.php');
2104 $LANG = t3lib_div
::makeInstance('language');
2105 $LANG->init($BE_USER->uc
['lang']);
2109 // ******************************
2110 // The template is loaded
2111 // ******************************
2112 $TBE_TEMPLATE = t3lib_div
::makeInstance('template');