From 215428f946dd70c99a1d512031e2e434d73856d8 Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Sat, 18 Feb 2012 12:39:17 +0100 Subject: [PATCH] [TASK] Move tslib_content classes to own files Change-Id: I8ba276f4cf2a20fa788972a629b17f02aab97c13 Resolves: #34058 Releases: 4.7 Reviewed-on: http://review.typo3.org/9085 Reviewed-by: Philipp Gampe Reviewed-by: Tolleiv Nietsch Tested-by: Tolleiv Nietsch Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- typo3/sysext/cms/ext_autoload.php | 6 +- .../sysext/cms/tslib/class.tslib_content.php | 383 +----------------- .../cms/tslib/class.tslib_controltable.php | 190 +++++++++ .../sysext/cms/tslib/class.tslib_frameset.php | 141 +++++++ .../cms/tslib/class.tslib_tableoffset.php | 124 ++++++ 5 files changed, 459 insertions(+), 385 deletions(-) create mode 100644 typo3/sysext/cms/tslib/class.tslib_controltable.php create mode 100644 typo3/sysext/cms/tslib/class.tslib_frameset.php create mode 100644 typo3/sysext/cms/tslib/class.tslib_tableoffset.php diff --git a/typo3/sysext/cms/ext_autoload.php b/typo3/sysext/cms/ext_autoload.php index 8b4e4867a69d..a8d9bac5ce70 100644 --- a/typo3/sysext/cms/ext_autoload.php +++ b/typo3/sysext/cms/ext_autoload.php @@ -5,9 +5,9 @@ return array( 'tslib_adminpanel' => PATH_tslib . 'class.tslib_adminpanel.php', 'tslib_cobj' => PATH_tslib . 'class.tslib_content.php', - 'tslib_frameset' => PATH_tslib . 'class.tslib_content.php', - 'tslib_tableoffset' => PATH_tslib . 'class.tslib_content.php', - 'tslib_controltable' => PATH_tslib . 'class.tslib_content.php', + 'tslib_frameset' => PATH_tslib . 'class.tslib_frameset.php', + 'tslib_tableoffset' => PATH_tslib . 'class.tslib_tableoffset.php', + 'tslib_controltable' => PATH_tslib . 'class.tslib_controltable.php', 'tslib_eidtools' => PATH_tslib . 'class.tslib_eidtools.php', 'tslib_fe' => PATH_tslib . 'class.tslib_fe.php', 'tslib_fecompression' => PATH_tslib . 'class.tslib_fecompression.php', diff --git a/typo3/sysext/cms/tslib/class.tslib_content.php b/typo3/sysext/cms/tslib/class.tslib_content.php index acbf39d17ad1..9cf7f57e953e 100644 --- a/typo3/sysext/cms/tslib/class.tslib_content.php +++ b/typo3/sysext/cms/tslib/class.tslib_content.php @@ -24,21 +24,6 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -/** - * Contains classes for Content Rendering based on TypoScript Template configuration - * - * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj - * XHTML compliant - * - * class tslib_cObj : All main TypoScript features, rendering of content objects (cObjects). This class is the backbone of TypoScript Template rendering. - * class tslib_controlTable : Makes a table CTABLE (TS cObject) - * class tslib_tableOffset : Makes a table-offset (TS) - * class tslib_frameset : Generates framesets (TS) - * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> - */ - - /** * This class contains all main TypoScript features. @@ -7981,374 +7966,8 @@ class tslib_cObj { } } - - -/** - * Rendering of framesets - * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> - * @package TYPO3 - * @subpackage tslib - */ -class tslib_frameset { - - /** - * Generates a frameset based on input configuration in a TypoScript array. - * - * @param array The TypoScript properties of the PAGE object property "frameSet.". See link. - * @return string A <frameset> tag. - * @see TSpagegen::renderContentWithHeader() - */ - function make($setup) { - $content = ''; - if (is_array($setup)) { - $sKeyArray = t3lib_TStemplate::sortedKeyList($setup); - foreach ($sKeyArray as $theKey) { - $theValue = $setup[$theKey]; - if (intval($theKey) && $conf = $setup[$theKey . '.']) { - switch ($theValue) { - case 'FRAME' : - $typeNum = intval($GLOBALS['TSFE']->tmpl->setup[$conf['obj'] . '.']['typeNum']); - if (!$conf['src'] && !$typeNum) { - $typeNum = -1; - } - $content .= '<frame' . $this->frameParams($conf, $typeNum) . ' />' . LF; - break; - case 'FRAMESET' : - $frameset = t3lib_div::makeInstance('tslib_frameset'); - $content .= $frameset->make($conf) . LF; - break; - } - } - } - return '<frameset' . $this->framesetParams($setup) . '>' . LF . $content . '</frameset>'; - } - } - - /** - * Creates the attributes for a <frame> tag based on a $conf array and the type number - * - * @param array Configuration for the parameter generation for the FRAME set. See link - * @param integer The typenumber to use for the link. - * @return string String with attributes for the frame-tag. With a prefixed space character. - * @access private - * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/7/9/ - * @see make(), t3lib_TStemplate::linkData() - */ - function frameParams($setup, $typeNum) { - $paramStr = ''; - $name = $setup['obj']; - - if ($setup['src'] || $setup['src.']) { - $src = $setup['src']; - if (is_array($setup['src.'])) { - $src = $GLOBALS['TSFE']->cObj->stdWrap($src, $setup['src.']); - } - $paramStr .= ' src="' . htmlspecialchars($src) . '"'; - } else { - $LD = $GLOBALS['TSFE']->tmpl->linkData( - $GLOBALS['TSFE']->page, - '', - $GLOBALS['TSFE']->no_cache, - '', - '', - ($setup['options'] ? '&' . $setup['options'] : '') . - $GLOBALS['TSFE']->cObj->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']), intval($typeNum) - ); - $finalURL = $LD['totalURL']; - $paramStr .= ' src="' . htmlspecialchars($finalURL) . '"'; - } - if ($setup['name']) { - $paramStr .= ' name="' . $setup['name'] . '"'; - } else { - $paramStr .= ' name="' . $name . '"'; - } - if ($setup['params']) { - $paramStr .= ' ' . $setup['params']; - } - return $paramStr; - } - - /** - * Creates the attributes for a <frameset> tag based on a conf array($setup) - * - * @param array The setup array(TypoScript properties) - * @return string Attributes with preceeding space. - * @access private - * @see make() - */ - function framesetParams($setup) { - $paramStr = ''; - if ($setup['cols']) { - $paramStr .= ' cols="' . $setup['cols'] . '"'; - } - if ($setup['rows']) { - $paramStr .= ' rows="' . $setup['rows'] . '"'; - } - if ($setup['params']) { - $paramStr .= ' ' . $setup['params']; - } - return $paramStr; - } -} - - - -/** - * Rendering of tables for offset - * - * @see tslib_cObj::OTABLE(), tslib_cObj::stdWrap() - * @author Kasper Skårhøj <kasperYYYY@typo3.com> - * @package TYPO3 - * @subpackage tslib - */ -class tslib_tableOffset { - var $tableParams = 'border="0" cellspacing="0" cellpadding="0"'; - var $default_tableParams = 'border="0" cellspacing="0" cellpadding="0"'; - var $tdParams = ' width="99%" valign="top"'; - - /** - * Wrapping the input content string in a table which will space it out from top/left/right/bottom - * - * @param string The HTML content string - * @param string List of offset parameters; x,y,r,b,w,h - * @return string The HTML content string being wrapped in a <table> offsetting the content as the $offset parameters defined - */ - function start($content, $offset) { - $valPairs = t3lib_div::intExplode(',', $offset . ',,,,,'); - - if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) { - // If width is defined AND there has been no change to the default table params, then extend them to a tablewidth of 1 - if ($valPairs[4] && $this->default_tableParams == $this->tableParams) { - $this->tableParams .= ' width="1"'; - } - // Init: - $this->begin = LF . '<table ' . $this->tableParams . '>'; - $this->end = '</table>'; - $rows = array(); - $widthImg = ''; - $heightImg = ''; - // If width is required, set so bottom column will display for sure - if ($valPairs[4]) { - if (!$valPairs[3]) - $valPairs[3] = 1; - $widthImg = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . - $valPairs[4] . '" height="1" alt="" title="" />'; - } - // If height is required, set so right column will display for sure - if ($valPairs[5]) { - if (!$valPairs[2]) - $valPairs[2] = 1; - $valPairs[2] = 1; - $heightImg = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="1" height="' . - $valPairs[5] . '" alt="" title="" />'; - } - - // First row: - if ($valPairs[1]) { // top - $rows[1] .= '<tr>'; - $rows[1] .= '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . - ($valPairs[0] ? $valPairs[0] : 1) . '" height="' . $valPairs[1] . '" alt="" title="" /></td>'; - if ($valPairs[0]) - $rows[1] .= '<td></td>'; - if ($valPairs[2]) - $rows[1] .= '<td></td>'; - $rows[1] .= '</tr>'; - } - // Middle row: - $rows[2] .= '<tr>'; - if ($valPairs[0]) { - $rows[2] .= $valPairs[1] ? '<td></td>' : '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" width="' . $valPairs[0] . '" height="1" alt="" title="" /></td>'; - } - $rows[2] .= '<td' . $this->tdParams . '>' . $content . '</td>'; - if ($valPairs[2]) { - $rows[2] .= $valPairs[3] ? '<td>' . $heightImg . '</td>' : '<td><img src="' . - $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $valPairs[2] . '" height="' . - ($valPairs[5] ? $valPairs[5] : 1) . '" alt="" title="" /></td>'; - } - $rows[2] .= '</tr>'; - // Bottom row: - if ($valPairs[3]) { // bottom - $rows[3] .= '<tr>'; - if ($valPairs[0]) - $rows[3] .= '<td></td>'; - if ($valPairs[2]) - $rows[3] .= '<td>' . $widthImg . '</td>'; - $rows[3] .= '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . - ($valPairs[2] ? $valPairs[2] : ($valPairs[4] ? $valPairs[4] : 1)) . '" height="' . - $valPairs[3] . '" alt="" title="" /></td>'; - $rows[3] .= '</tr>'; - } - return $this->begin . implode('', $rows) . $this->end; - } else - return $content; - } -} - - - -/** - * Rendering of tables for content positioning - * - * @see tslib_cObj::CTABLE() - * @author Kasper Skårhøj <kasperYYYY@typo3.com> - * @package TYPO3 - * @subpackage tslib - */ -class tslib_controlTable { - var $offX = 0; // offset, x - var $offY = 0; // offset, y - - - var $tm = ''; // top menu - var $lm = ''; // left menu - var $rm = ''; // right menu - var $bm = ''; // bottom menu - var $content = ''; // content - - - var $tmTDparams = 'valign="top"'; // top menu TDparams - var $lmTDparams = 'valign="top"'; // left menu TDparams - var $rmTDparams = 'valign="top"'; // right menu TDparams - var $bmTDparams = 'valign="top"'; // bottom menu TDparams - var $contentTDparams = 'valign="top"'; // content TDparams - - - var $cMl = 1; // content margin, left - var $cMr = 1; // content margin, right - var $cMt = 0; // content margin, top - var $cMb = 1; // content margin, bottom - - - var $contentW = 0; // Places a little gif-spacer in the bottom of the content frame - - - var $tableParams = 'border="0" cellspacing="0" cellpadding="0"'; - - /** - * Wrapping internal vars ->tm, ->lm, ->rm, ->bm and ->content in a table where each content part is stored in a cell. - * The two arguments to this function defines some offsets and margins to use in the arrangement of the content in the table. - * - * @param string List of offset parameters; x,y - * @param string List of margin parameters; left, top, right, bottom - * @return string The content strings wrapped in a <table> as the parameters defined - * @see tslib_cObj::CTABLE() - */ - function start($offset, $cMargins) { - $offArr = t3lib_div::intExplode(',', $offset); - $cMargArr = t3lib_div::intExplode(',', $cMargins); - - $cols = 0; - $rows = 0; - - if ($this->lm) - $cols++; - if ($this->rm) - $cols++; - if ($cMargArr[0]) - $cols++; - if ($cMargArr[2]) - $cols++; - if ($cMargArr[1] || $cMargArr[3] || $this->tm || $this->bm || $this->content || $this->contentW) - $cols++; - - if ($cMargArr[1]) - $rows++; - if ($cMargArr[3]) - $rows++; - if ($this->tm) - $rows++; - if ($this->bm) - $rows++; - if ($this->content) - $rows++; - if ($this->contentW) - $rows++; - if (!$rows && $cols) - $rows = 1; // If there are no rows in the middle but still som columns... - - - if ($rows && $cols) { - $res = LF . '<table ' . $this->tableParams . '>'; - // top offset: - if ($offArr[1]) { - $xoff = $offArr[0] ? 1 : 0; - if ($cols + $xoff > 1) { - $colspan = ' colspan="' . ($cols + $xoff) . '"'; - } - $res .= '<tr><td' . $colspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" width="1" height="' . $offArr[1] . '" alt="" title="" /></td></tr>'; - } - // The rows: - if ($rows > 1) { - $rowspan = ' rowspan="' . ($rows) . '"'; - } - $res .= '<tr>'; - if ($offArr[0]) { - $res .= '<td' . $rowspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" height="1" width="' . $offArr[0] . '" alt="" title="" /></td>'; - } - if ($this->lm) { - $res .= '<td' . $rowspan . ' ' . $this->lmTDparams . '>' . $this->lm . '</td>'; - } - if ($cMargArr[0]) { - $res .= '<td' . $rowspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" height="1" width="' . $cMargArr[0] . '" alt="" title="" /></td>'; - } - // content... - - - $middle = array(); - if ($this->tm) { - $middle[] = '<td ' . $this->tmTDparams . '>' . $this->tm . '</td>'; - } - if ($cMargArr[1]) { - $middle[] = '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" width="1" height="' . $cMargArr[1] . '" alt="" title="" /></td>'; - } - if ($this->content) { - $middle[] = '<td ' . $this->contentTDparams . '>' . $this->content . '</td>'; - } - if ($cMargArr[3]) { - $middle[] = '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" width="1" height="' . $cMargArr[3] . '" alt="" title="" /></td>'; - } - if ($this->bm) { - $middle[] = '<td ' . $this->bmTDparams . '>' . $this->bm . '</td>'; - } - if ($this->contentW) { - $middle[] = '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" height="1" width="' . $this->contentW . '" alt="" title="" /></td>'; - } - if (isset($middle[0])) { - $res .= $middle[0]; - } - - // Left of content - if ($cMargArr[2]) { - $res .= '<td' . $rowspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . - 'clear.gif" height="1" width="' . $cMargArr[2] . '" alt="" title="" /></td>'; - } - if ($this->rm) { - $res .= '<td' . $rowspan . ' ' . $this->rmTDparams . '>' . $this->rm . '</td>'; - } - $res .= '</tr>'; - - // More than the two rows - $mCount = count($middle); - for ($a = 1; $a < $mCount; $a++) { - $res .= '<tr>' . $middle[$a] . '</tr>'; - } - $res .= '</table>'; - return $res; - } - } -} - - if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php'])) { include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']); } -?> +?> \ No newline at end of file diff --git a/typo3/sysext/cms/tslib/class.tslib_controltable.php b/typo3/sysext/cms/tslib/class.tslib_controltable.php new file mode 100644 index 000000000000..f23e8891f554 --- /dev/null +++ b/typo3/sysext/cms/tslib/class.tslib_controltable.php @@ -0,0 +1,190 @@ +<?php +/*************************************************************** + * Copyright notice + * + * (c) 1999-2012 Kasper Skårhøj (kasperYYYY@typo3.com) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Rendering of tables for content positioning + * + * @see tslib_cObj::CTABLE() + * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @package TYPO3 + * @subpackage tslib + */ +class tslib_controlTable { + var $offX = 0; // offset, x + var $offY = 0; // offset, y + + + var $tm = ''; // top menu + var $lm = ''; // left menu + var $rm = ''; // right menu + var $bm = ''; // bottom menu + var $content = ''; // content + + + var $tmTDparams = 'valign="top"'; // top menu TDparams + var $lmTDparams = 'valign="top"'; // left menu TDparams + var $rmTDparams = 'valign="top"'; // right menu TDparams + var $bmTDparams = 'valign="top"'; // bottom menu TDparams + var $contentTDparams = 'valign="top"'; // content TDparams + + + var $cMl = 1; // content margin, left + var $cMr = 1; // content margin, right + var $cMt = 0; // content margin, top + var $cMb = 1; // content margin, bottom + + + var $contentW = 0; // Places a little gif-spacer in the bottom of the content frame + + + var $tableParams = 'border="0" cellspacing="0" cellpadding="0"'; + + /** + * Wrapping internal vars ->tm, ->lm, ->rm, ->bm and ->content in a table where each content part is stored in a cell. + * The two arguments to this function defines some offsets and margins to use in the arrangement of the content in the table. + * + * @param string List of offset parameters; x,y + * @param string List of margin parameters; left, top, right, bottom + * @return string The content strings wrapped in a <table> as the parameters defined + * @see tslib_cObj::CTABLE() + */ + function start($offset, $cMargins) { + $offArr = t3lib_div::intExplode(',', $offset); + $cMargArr = t3lib_div::intExplode(',', $cMargins); + + $cols = 0; + $rows = 0; + + if ($this->lm) + $cols++; + if ($this->rm) + $cols++; + if ($cMargArr[0]) + $cols++; + if ($cMargArr[2]) + $cols++; + if ($cMargArr[1] || $cMargArr[3] || $this->tm || $this->bm || $this->content || $this->contentW) + $cols++; + + if ($cMargArr[1]) + $rows++; + if ($cMargArr[3]) + $rows++; + if ($this->tm) + $rows++; + if ($this->bm) + $rows++; + if ($this->content) + $rows++; + if ($this->contentW) + $rows++; + if (!$rows && $cols) + $rows = 1; // If there are no rows in the middle but still som columns... + + + if ($rows && $cols) { + $res = LF . '<table ' . $this->tableParams . '>'; + // top offset: + if ($offArr[1]) { + $xoff = $offArr[0] ? 1 : 0; + if ($cols + $xoff > 1) { + $colspan = ' colspan="' . ($cols + $xoff) . '"'; + } + $res .= '<tr><td' . $colspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" width="1" height="' . $offArr[1] . '" alt="" title="" /></td></tr>'; + } + // The rows: + if ($rows > 1) { + $rowspan = ' rowspan="' . ($rows) . '"'; + } + $res .= '<tr>'; + if ($offArr[0]) { + $res .= '<td' . $rowspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" height="1" width="' . $offArr[0] . '" alt="" title="" /></td>'; + } + if ($this->lm) { + $res .= '<td' . $rowspan . ' ' . $this->lmTDparams . '>' . $this->lm . '</td>'; + } + if ($cMargArr[0]) { + $res .= '<td' . $rowspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" height="1" width="' . $cMargArr[0] . '" alt="" title="" /></td>'; + } + // content... + + + $middle = array(); + if ($this->tm) { + $middle[] = '<td ' . $this->tmTDparams . '>' . $this->tm . '</td>'; + } + if ($cMargArr[1]) { + $middle[] = '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" width="1" height="' . $cMargArr[1] . '" alt="" title="" /></td>'; + } + if ($this->content) { + $middle[] = '<td ' . $this->contentTDparams . '>' . $this->content . '</td>'; + } + if ($cMargArr[3]) { + $middle[] = '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" width="1" height="' . $cMargArr[3] . '" alt="" title="" /></td>'; + } + if ($this->bm) { + $middle[] = '<td ' . $this->bmTDparams . '>' . $this->bm . '</td>'; + } + if ($this->contentW) { + $middle[] = '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" height="1" width="' . $this->contentW . '" alt="" title="" /></td>'; + } + if (isset($middle[0])) { + $res .= $middle[0]; + } + + // Left of content + if ($cMargArr[2]) { + $res .= '<td' . $rowspan . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" height="1" width="' . $cMargArr[2] . '" alt="" title="" /></td>'; + } + if ($this->rm) { + $res .= '<td' . $rowspan . ' ' . $this->rmTDparams . '>' . $this->rm . '</td>'; + } + $res .= '</tr>'; + + // More than the two rows + $mCount = count($middle); + for ($a = 1; $a < $mCount; $a++) { + $res .= '<tr>' . $middle[$a] . '</tr>'; + } + $res .= '</table>'; + return $res; + } + } +} + +if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_controltable.php'])) { + include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_controltable.php']); +} + +?> \ No newline at end of file diff --git a/typo3/sysext/cms/tslib/class.tslib_frameset.php b/typo3/sysext/cms/tslib/class.tslib_frameset.php new file mode 100644 index 000000000000..34598cbc54d9 --- /dev/null +++ b/typo3/sysext/cms/tslib/class.tslib_frameset.php @@ -0,0 +1,141 @@ +<?php +/*************************************************************** + * Copyright notice + * + * (c) 1999-2012 Kasper Skårhøj (kasperYYYY@typo3.com) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Rendering of framesets + * + * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @package TYPO3 + * @subpackage tslib + */ +class tslib_frameset { + + /** + * Generates a frameset based on input configuration in a TypoScript array. + * + * @param array The TypoScript properties of the PAGE object property "frameSet.". See link. + * @return string A <frameset> tag. + * @see TSpagegen::renderContentWithHeader() + */ + function make($setup) { + $content = ''; + if (is_array($setup)) { + $sKeyArray = t3lib_TStemplate::sortedKeyList($setup); + foreach ($sKeyArray as $theKey) { + $theValue = $setup[$theKey]; + if (intval($theKey) && $conf = $setup[$theKey . '.']) { + switch ($theValue) { + case 'FRAME' : + $typeNum = intval($GLOBALS['TSFE']->tmpl->setup[$conf['obj'] . '.']['typeNum']); + if (!$conf['src'] && !$typeNum) { + $typeNum = -1; + } + $content .= '<frame' . $this->frameParams($conf, $typeNum) . ' />' . LF; + break; + case 'FRAMESET' : + $frameset = t3lib_div::makeInstance('tslib_frameset'); + $content .= $frameset->make($conf) . LF; + break; + } + } + } + return '<frameset' . $this->framesetParams($setup) . '>' . LF . $content . '</frameset>'; + } + } + + /** + * Creates the attributes for a <frame> tag based on a $conf array and the type number + * + * @param array Configuration for the parameter generation for the FRAME set. See link + * @param integer The typenumber to use for the link. + * @return string String with attributes for the frame-tag. With a prefixed space character. + * @access private + * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/7/9/ + * @see make(), t3lib_TStemplate::linkData() + */ + function frameParams($setup, $typeNum) { + $paramStr = ''; + $name = $setup['obj']; + + if ($setup['src'] || $setup['src.']) { + $src = $setup['src']; + if (is_array($setup['src.'])) { + $src = $GLOBALS['TSFE']->cObj->stdWrap($src, $setup['src.']); + } + $paramStr .= ' src="' . htmlspecialchars($src) . '"'; + } else { + $LD = $GLOBALS['TSFE']->tmpl->linkData( + $GLOBALS['TSFE']->page, + '', + $GLOBALS['TSFE']->no_cache, + '', + '', + ($setup['options'] ? '&' . $setup['options'] : '') . + $GLOBALS['TSFE']->cObj->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']), intval($typeNum) + ); + $finalURL = $LD['totalURL']; + $paramStr .= ' src="' . htmlspecialchars($finalURL) . '"'; + } + if ($setup['name']) { + $paramStr .= ' name="' . $setup['name'] . '"'; + } else { + $paramStr .= ' name="' . $name . '"'; + } + if ($setup['params']) { + $paramStr .= ' ' . $setup['params']; + } + return $paramStr; + } + + /** + * Creates the attributes for a <frameset> tag based on a conf array($setup) + * + * @param array The setup array(TypoScript properties) + * @return string Attributes with preceeding space. + * @access private + * @see make() + */ + function framesetParams($setup) { + $paramStr = ''; + if ($setup['cols']) { + $paramStr .= ' cols="' . $setup['cols'] . '"'; + } + if ($setup['rows']) { + $paramStr .= ' rows="' . $setup['rows'] . '"'; + } + if ($setup['params']) { + $paramStr .= ' ' . $setup['params']; + } + return $paramStr; + } +} + +if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_frameset.php'])) { + include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_frameset.php']); +} + +?> \ No newline at end of file diff --git a/typo3/sysext/cms/tslib/class.tslib_tableoffset.php b/typo3/sysext/cms/tslib/class.tslib_tableoffset.php new file mode 100644 index 000000000000..b1d7f3b843c9 --- /dev/null +++ b/typo3/sysext/cms/tslib/class.tslib_tableoffset.php @@ -0,0 +1,124 @@ +<?php +/*************************************************************** + * Copyright notice + * + * (c) 1999-2012 Kasper Skårhøj (kasperYYYY@typo3.com) + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Rendering of tables for offset + * + * @see tslib_cObj::OTABLE(), tslib_cObj::stdWrap() + * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @package TYPO3 + * @subpackage tslib + */ +class tslib_tableOffset { + var $tableParams = 'border="0" cellspacing="0" cellpadding="0"'; + var $default_tableParams = 'border="0" cellspacing="0" cellpadding="0"'; + var $tdParams = ' width="99%" valign="top"'; + + /** + * Wrapping the input content string in a table which will space it out from top/left/right/bottom + * + * @param string The HTML content string + * @param string List of offset parameters; x,y,r,b,w,h + * @return string The HTML content string being wrapped in a <table> offsetting the content as the $offset parameters defined + */ + function start($content, $offset) { + $valPairs = t3lib_div::intExplode(',', $offset . ',,,,,'); + + if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) { + // If width is defined AND there has been no change to the default table params, then extend them to a tablewidth of 1 + if ($valPairs[4] && $this->default_tableParams == $this->tableParams) { + $this->tableParams .= ' width="1"'; + } + // Init: + $this->begin = LF . '<table ' . $this->tableParams . '>'; + $this->end = '</table>'; + $rows = array(); + $widthImg = ''; + $heightImg = ''; + // If width is required, set so bottom column will display for sure + if ($valPairs[4]) { + if (!$valPairs[3]) + $valPairs[3] = 1; + $widthImg = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . + $valPairs[4] . '" height="1" alt="" title="" />'; + } + // If height is required, set so right column will display for sure + if ($valPairs[5]) { + if (!$valPairs[2]) + $valPairs[2] = 1; + $valPairs[2] = 1; + $heightImg = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="1" height="' . + $valPairs[5] . '" alt="" title="" />'; + } + + // First row: + if ($valPairs[1]) { // top + $rows[1] .= '<tr>'; + $rows[1] .= '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . + ($valPairs[0] ? $valPairs[0] : 1) . '" height="' . $valPairs[1] . '" alt="" title="" /></td>'; + if ($valPairs[0]) + $rows[1] .= '<td></td>'; + if ($valPairs[2]) + $rows[1] .= '<td></td>'; + $rows[1] .= '</tr>'; + } + // Middle row: + $rows[2] .= '<tr>'; + if ($valPairs[0]) { + $rows[2] .= $valPairs[1] ? '<td></td>' : '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . + 'clear.gif" width="' . $valPairs[0] . '" height="1" alt="" title="" /></td>'; + } + $rows[2] .= '<td' . $this->tdParams . '>' . $content . '</td>'; + if ($valPairs[2]) { + $rows[2] .= $valPairs[3] ? '<td>' . $heightImg . '</td>' : '<td><img src="' . + $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $valPairs[2] . '" height="' . + ($valPairs[5] ? $valPairs[5] : 1) . '" alt="" title="" /></td>'; + } + $rows[2] .= '</tr>'; + // Bottom row: + if ($valPairs[3]) { // bottom + $rows[3] .= '<tr>'; + if ($valPairs[0]) + $rows[3] .= '<td></td>'; + if ($valPairs[2]) + $rows[3] .= '<td>' . $widthImg . '</td>'; + $rows[3] .= '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . + ($valPairs[2] ? $valPairs[2] : ($valPairs[4] ? $valPairs[4] : 1)) . '" height="' . + $valPairs[3] . '" alt="" title="" /></td>'; + $rows[3] .= '</tr>'; + } + return $this->begin . implode('', $rows) . $this->end; + } else + return $content; + } +} + +if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_tableoffset.php'])) { + include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_tableoffset.php']); +} + +?> \ No newline at end of file -- GitLab