Project

General

Profile

Bug #24564 ยป 17024.diff

Administrator Admin, 2011-01-20 22:48

View differences:

t3lib/class.t3lib_tceforms.php (working copy)
'$(\'' . $rowId . '\').removeClassName(\'c-selectedItem\');$(\'' . $rowId . '\').removeClassName(\'c-unselectedItem\');' .
'$(\'' . $rowId . '\').addClassName(\'c-' . ($sM ? '' : 'un') . 'selectedItem\');';
$hasHelp = ($p[3] != '');
// Check if some help text is available
// Since TYPO3 4.5 help text is expected to be an associative array
// with two key, "title" and "description"
// For the sake of backwards compatibility, we test if the help text
// is a string and use it as a description (this could happen if items
// are modified with an itemProcFunc)
$hasHelp = FALSE;
$help = '';
$helpArray = array();
if ((is_array($p[3]) && count($p[3]) > 0) || !empty($p[3])) {
$hasHelp = TRUE;
if (is_array($p[3])) {
$helpArray = $p[3];
} else {
$helpArray['description'] = $p[3];
}
}
$label = t3lib_div::deHSCentities(htmlspecialchars($p[0]));
$help = $hasHelp ? '<span class="typo3-csh-inline"><span class="header">' . $label . '</span>' .
'<span class="paragraph">' . $GLOBALS['LANG']->hscAndCharConv(nl2br(trim(htmlspecialchars($p[3]))), false) . '</span></span>' : '';
if ($hasHelp && $this->edit_showFieldHelp == 'icon') {
$helpIcon = '<a class="typo3-csh-link" href="#">';
$helpIcon .= t3lib_iconWorks::getSpriteIcon('actions-system-help-open');
$helpIcon .= $help;
$helpIcon .= '</a>';
$help = $helpIcon;
if ($hasHelp) {
$help = t3lib_BEfunc::wrapInHelp('', '', '', $helpArray);
}
$tRows[] = '
......
$this->getIconHtml($selIcon) .
$label .
'</td>
<td class="c-descr" onclick="' . htmlspecialchars($onClickCell) . '">' . (strcmp($p[3], '') ? $help : '') . '</td>
<td class="c-descr" onclick="' . htmlspecialchars($onClickCell) . '">' . ((empty($help)) ? '' : $help) . '</td>
</tr>';
$c++;
}
......
// Icon:
$icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName($theTableNames, array());
// Add description texts:
if ($this->edit_showFieldHelp) {
$GLOBALS['LANG']->loadSingleTableDescription($theTableNames);
$fDat = $GLOBALS['TCA_DESCR'][$theTableNames]['columns'][''];
$descr = $fDat['description'];
// Add help text
$helpText = array();
$GLOBALS['LANG']->loadSingleTableDescription($theTableNames);
$helpTextArray = $GLOBALS['TCA_DESCR'][$theTableNames]['columns'][''];
if (isset($helpTextArray['description'])) {
$helpText['description'] = $helpTextArray['description'];
}
// Item configuration:
......
$this->sL($TCA[$theTableNames]['ctrl']['title']),
$theTableNames,
$icon,
$descr
$helpText
);
}
}
......
foreach ($theTypes as $theTypeArrays) {
list($theTable, $theField) = explode(':', $theTypeArrays[1]);
// Add description texts:
if ($this->edit_showFieldHelp) {
$GLOBALS['LANG']->loadSingleTableDescription($theTable);
$fDat = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theField];
$descr = $fDat['description'];
// Add help text
$helpText = array();
$GLOBALS['LANG']->loadSingleTableDescription($theTable);
$helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theField];
if (isset($helpTextArray['description'])) {
$helpText['description'] = $helpTextArray['description'];
}
// Item configuration:
......
rtrim($theTypeArrays[0], ':'),
$theTypeArrays[1],
'empty-empty',
$descr
$helpText
);
}
break;
......
$icon = 'empty-empty';
}
// Add help text
$helpText = array();
if (isset($itemCfg[2])) {
$helpText['description'] = $GLOBALS['LANG']->sl($itemCfg[2]);
}
// Add item to be selected:
$items[] = array(
$GLOBALS['LANG']->sl($itemCfg[0]),
$coKey . ':' . preg_replace('/[:|,]/', '', $itemKey),
$icon,
$GLOBALS['LANG']->sl($itemCfg[2]),
$helpText,
);
}
}
......
$icon = '../' . substr($icon, strlen(PATH_site));
}
// Description texts:
if ($this->edit_showFieldHelp) {
$descr = $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tablabel'] .
LF .
$GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tabdescr'];
}
// Add help text
$helpText = array(
'title' => $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tablabel'],
'description' => $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tabdescr']
);
// Item configuration:
$items[] = array(
$this->addSelectOptionsToItemArray_makeModuleData($theMod),
$theMod,
$icon,
$descr
$helpText
);
}
}
t3lib/js/extjs/contexthelp.js (working copy)
if (response) {
updateTip(response);
} else {
// clear old tooltip contents
updateTip({
description: top.TYPO3.LLL.core.csh_tooltip_loading,
cshLink: '',
moreInfo: '',
title: ''
});
// load content
TYPO3.CSH.ExtDirect.getContextHelp(table, field, function(response, options) {
cshHelp.add(response);
updateTip(response);
// Need to re-position because the height may have increased
tip.show();
}, this);
// If a table is defined, use ExtDirect call to get the tooltip's content
if (table) {
// Clear old tooltip contents
updateTip({
description: top.TYPO3.LLL.core.csh_tooltip_loading,
cshLink: '',
moreInfo: '',
title: ''
});
// Load content
TYPO3.CSH.ExtDirect.getContextHelp(table, field, function(response, options) {
cshHelp.add(response);
updateTip(response);
// Need to re-position because the height may have increased
tip.show();
}, this);
// No table was given, use directly title and description
} else {
updateTip({
description: link.getAttribute('data-description'),
cshLink: '',
moreInfo: '',
title: link.getAttribute('data-title')
});
}
}
}
t3lib/class.t3lib_befunc.php (working copy)
* @return string the HTML code ready to render
* @api public
*/
public static function wrapInHelp($table, $field, $text = '') {
// get the help text that should be shown on hover
$GLOBALS['LANG']->loadSingleTableDescription($table);
$helpText = self::helpText($table, $field);
public static function wrapInHelp($table, $field, $text = '', array $overloadHelpText = array()) {
// Initialize some avriables
$helpText = '';
$abbrClassAdd = '';
if ($helpText) {
// if no text was given, just use the regular help icon
$wrappedText = '';
$hasHelpTextOverload = count($overloadHelpText) > 0;
// Get the help text that should be shown on hover
if (!$hasHelpTextOverload) {
$helpText = self::helpText($table, $field);
}
// If there's a help text or some overload information, proceed with preparing an output
if (!empty($helpText) || $hasHelpTextOverload) {
// If no text was given, just use the regular help icon
if ($text == '') {
$text = t3lib_iconWorks::getSpriteIcon('actions-system-help-open');
$abbrClassAdd = '-icon';
}
$text = '<abbr class="t3-help-teaser' . $abbrClassAdd . '">' . $text . '</abbr>';
$text = '<span class="t3-help-link" href="#" data-table="' . $table . '" data-field="' . $field . '">' . $text . '</span>';
$wrappedText = '<span class="t3-help-link" href="#" data-table="' . $table . '" data-field="' . $field . '"';
// The overload array may provide a title and a description
// If either one is defined, add them to the "data" attributes
if ($hasHelpTextOverload) {
if (isset($overloadHelpText['title'])) {
$wrappedText .= ' data-title="' . htmlspecialchars($overloadHelpText['title']) . '"';
}
if (isset($overloadHelpText['description'])) {
$wrappedText .= ' data-description="' . htmlspecialchars($overloadHelpText['description']) . '"';
}
}
$wrappedText .= '>' . $text . '</span>';
}
return $text;
return $wrappedText;
}
    (1-1/1)