Commit b82f30fe authored by Benni Mack's avatar Benni Mack
Browse files

[CLEANUP] Deprecate unused/non-unified DocumentTemplate code

Several functions within DocumentTemplate are
not encouraged to be used anymore.

The hard-coded background image setting
via $TBE_STYLES['background'] is removed
and its usage is deprecated.

Additionally, the font-wrapping methods
are deprecated. All places in the core using
these methods are removed. The according
CSS was removed from the core (can still
be used via 3rd party extensions).

collapseableSection, which was used solely
by the reports module for ages in a buggy
way, is also deprecated in favor of Bootstrap
collapseables and localstorage.

Change-Id: If1abdeb1d9491efb385b41eb4d1faf4e1dbc91e0
Resolves: #62988
Releases: master
Reviewed-on: http://review.typo3.org/34209


Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack's avatarBenjamin Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenjamin Mack <benni@typo3.org>
parent ee967b66
......@@ -483,7 +483,7 @@ class Clipboard {
if ($el) {
return '<strong>' . $str . '</strong> (' . ($pad == 'normal' ? ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) : htmlspecialchars($el)) . ')';
} else {
return $GLOBALS['TBE_TEMPLATE']->dfw($str);
return '<span class="text-muted">' . $str . '</span>';
}
}
......@@ -498,13 +498,13 @@ class Clipboard {
public function linkItemText($str, $rec, $table = '') {
if (is_array($rec) && $table) {
if ($this->fileMode) {
$str = $GLOBALS['TBE_TEMPLATE']->dfw($str);
$str = '<span class="text-muted">' . $str . '</span>';
} else {
$str = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_list', array('id' => $rec['pid']), $this->backPath)) . '">' . $str . '</a>';
}
} elseif (file_exists($rec)) {
if (!$this->fileMode) {
$str = $GLOBALS['TBE_TEMPLATE']->dfw($str);
$str = '<span class="text-muted">' . $str . '</span>';
} else {
if (ExtensionManagementUtility::isLoaded('filelist')) {
$str = '<a href="' . htmlspecialchars(($this->backPath . BackendUtility::getModuleUrl('file_list') . '&id=' . dirname($rec))) . '">' . $str . '</a>';
......
......@@ -843,7 +843,7 @@ class PageLayoutController {
$h_func_b = '<div class="checkbox">' .
'<label for="checkTt_content_showHidden">' .
BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') .
(!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE', TRUE)) : $GLOBALS['LANG']->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') .
(!$q_count ? ('<span class="text-muted">' . $GLOBALS['LANG']->getLL('hiddenCE', TRUE) . '</span>') : $GLOBALS['LANG']->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') .
'</label>' .
'</div>';
......@@ -942,7 +942,7 @@ class PageLayoutController {
$h_func_b = '<div class="checkbox">' .
'<label for="checkTt_content_showHidden">' .
BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') .
(!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE')) : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') .
(!$q_count ? ('<span class="text-muted">' . $GLOBALS['LANG']->getLL('hiddenCE') . '</span>') : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') .
'</label>' .
'</div>';
......
......@@ -244,6 +244,7 @@ function jumpToUrl(URL) {
* Background image of page (relative to PATH_typo3)
*
* @var string
* @deprecated since TYPO3 CMS 7, will be removed in CMS 8, use a stylesheet instead
*/
public $backGroundImage = '';
......@@ -427,7 +428,7 @@ function jumpToUrl(URL) {
}
// Background image
if ($GLOBALS['TBE_STYLES']['background']) {
$this->backGroundImage = $GLOBALS['TBE_STYLES']['background'];
GeneralUtility::deprecationLog('Usage of $TBE_STYLES["background"] is deprecated. Please use stylesheets directly.');
}
}
......@@ -1080,6 +1081,7 @@ function jumpToUrl(URL) {
* @deprecated since TYPO3 CMS 7, will be removed in CMS 8, nothing there to output anymore
*/
public function endPageJS() {
GeneralUtility::logDeprecatedFunction();
return '';
}
......@@ -1099,10 +1101,6 @@ function jumpToUrl(URL) {
* @return string HTML style section/link tags
*/
public function docStyle() {
// Request background image:
if ($this->backGroundImage) {
$this->inDocStylesArray[] = ' BODY { background-image: url(' . $this->backPath . $this->backGroundImage . '); }';
}
// Implode it all:
$inDocStyles = implode(LF, $this->inDocStylesArray);
......@@ -1293,9 +1291,11 @@ function jumpToUrl(URL) {
*
* @param string $string Input string
* @return string Output string
* @deprecated since TYPO3 CMS 7, will be removed in CMS 8, use proper HTML directly
*/
public function dfw($string) {
return '<span class="typo3-dimmed">' . $string . '</span>';
GeneralUtility::logDeprecatedFunction();
return '<span class="text-muted">' . $string . '</span>';
}
/**
......@@ -1303,9 +1303,11 @@ function jumpToUrl(URL) {
*
* @param string $string Input string
* @return string Output string
* @deprecated since TYPO3 CMS 7, will be removed in CMS 8, use proper HTML directly
*/
public function rfw($string) {
return '<span class="typo3-red">' . $string . '</span>';
GeneralUtility::logDeprecatedFunction();
return '<span class="text-danger">' . $string . '</span>';
}
/**
......@@ -1580,10 +1582,13 @@ function jumpToUrl(URL) {
* @param bool $noWrap Deprecated - delivered by CSS
* @param bool $fullWidth If set, the tabs will span the full width of their position
* @param int $defaultTabIndex 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.
* @param int $tabBehaviour If set to '1' empty tabs will be remove, If set to '2' empty tabs will be disabled
* @param int $tabBehaviour If set to '1' empty tabs will be remove, If set to '2' empty tabs will be disabled. setting this option to '2' is deprecated since TYPO3 CMS 7, and will be removed iwth CMS 8
* @return string JavaScript section for the HTML header.
*/
public function getDynTabMenu($menuItems, $identString, $toggle = 0, $foldout = FALSE, $noWrap = TRUE, $fullWidth = FALSE, $defaultTabIndex = 1, $tabBehaviour = 1) {
if ($tabBehaviour === 2) {
GeneralUtility::deprecationLog('DocumentTemplate::getDynTabMenu parameter $tabBehavior (=2) with showing empty disabled since TYPO3 CMS 7, and will not be supported anymore with CMS 8');
}
// Load the static code, if not already done with the function below
$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tabmenu.js');
$content = '';
......@@ -1948,8 +1953,10 @@ function jumpToUrl(URL) {
* @param string $id
* @param string $saveStatePointer
* @return string
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use HTML bootstrap classes, localStorage etc.
*/
public function collapseableSection($title, $html, $id, $saveStatePointer = '') {
GeneralUtility::logDeprecatedFunction();
$hasSave = $saveStatePointer ? TRUE : FALSE;
$collapsedStyle = ($collapsedClass = '');
if ($hasSave) {
......
......@@ -1073,7 +1073,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
}
// Wrap in dimmed-span tags if record is "disabled"
if ($this->isDisabled($table, $row)) {
$out[$fieldName] = $this->getDocumentTemplate()->dfw($out[$fieldName]);
$out[$fieldName] = '<span class="text-muted">' . $out[$fieldName] . '</span>';
}
}
return $out;
......@@ -1615,7 +1615,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
}
// Return values:
if ($this->isDisabled('tt_content', $row)) {
return $this->getDocumentTemplate()->dfw($out);
return '<span class="text-muted">' . $out . '</span>';
} else {
return $out;
}
......
========================================================================
Deprecation: #62988 - Deprecate unused/non-unified DocumentTemplate code
========================================================================
Description
===========
Several functions within DocumentTemplate are not encouraged to be used anymore.
The hard-coded background image setting via $TBE_STYLES['background'] is removed and its usage is deprecated.
Additionally, the font-wrapping methods *rfw()* and *dfw()* are deprecated.
The according CSS was removed from the core.
The method *collapseableSection()*, which was used solely by the reports module for ages in a buggy
way, is also deprecated in favor of Bootstrap collapseables and localstorage.
Impact
======
The core does not use this functionality anymore.
Affected installations
======================
All installations which use the setting *$GLOBALS['TBE_STYLES']['background']* or any of the functions:
* dfw()
* rfw()
* collapseableSection()
Migration
=========
* Use CSS directly instead of *$GLOBALS['TBE_STYLES']['background']*
* Use the CSS class *text-muted* instead of the method *dfw()*
* Use the CSS class *text-danger* instead of the method *rfw()*
* Use HTML bootstrap classes, localStorage etc. instead of *collapseableSection()*
......@@ -781,7 +781,7 @@ class IndexedPagesController extends \TYPO3\CMS\Backend\Module\AbstractFunctionM
foreach ($extraGrListRows as $r) {
$lines[] = $r['gr_list'];
}
return '<br />' . $GLOBALS['TBE_TEMPLATE']->dfw(implode('<br />', $lines));
return '<br /><span class="text-muted">' . implode('<br />', $lines) . '</span>';
}
}
......
......@@ -53,14 +53,6 @@ table.t3-table-info td {
padding: 5px;
}
.typo3-dimmed {
.text-muted;
}
.typo3-red {
color: red;
}
.typo3-red-background {
background-color: red;
}
......
......@@ -6408,12 +6408,6 @@ table.t3-table-info td {
vertical-align: middle;
padding: 5px;
}
.typo3-dimmed {
color: #737373;
}
.typo3-red {
color: red;
}
.typo3-red-background {
background-color: red;
}
......
......@@ -73,7 +73,7 @@ class SortPagesWizardModuleFunction extends \TYPO3\CMS\Backend\Module\AbstractFu
$m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2);
// edit permissions for that page!
$pRec = BackendUtility::getRecord('pages', $rec['uid'], 'uid', ' AND ' . $m_perms_clause);
$lines[] = '<tr class="db_list_normal"><td nowrap="nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec) . (!is_array($pRec) ? $GLOBALS['TBE_TEMPLATE']->rfw('<strong>' . $GLOBALS['LANG']->getLL('wiz_W', TRUE) . '</strong> ') : '') . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</td>
$lines[] = '<tr class="db_list_normal"><td nowrap="nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec) . (!is_array($pRec) ? '<strong class="text-danger">' . $GLOBALS['LANG']->getLL('wiz_W', TRUE) . '</strong></span> ' : '') . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</td>
<td nowrap="nowrap">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['subtitle'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</td>
<td nowrap="nowrap">' . BackendUtility::datetime($rec['tstamp']) . '</td>
<td nowrap="nowrap">' . BackendUtility::datetime($rec['crdate']) . '</td>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment