Project

General

Profile

Bug #23728 » csh_new_api_tceforms_v2.patch

Administrator Admin, 2010-10-15 22:57

View differences:

t3lib/class.t3lib_tceforms.php (Arbeitskopie)
}
// If the record has been saved and the "linkTitleToSelf" is set, we make the field name into a link, which will load ONLY this field in alt_doc.php
$PA['label'] = t3lib_div::deHSCentities(htmlspecialchars($PA['label']));
$label = t3lib_div::deHSCentities(htmlspecialchars($PA['label']));
if (t3lib_div::testInt($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf'] && !t3lib_div::_GP('columnsOnly')) {
$lTTS_url = $this->backPath.'alt_doc.php?edit['.$table.']['.$row['uid'].']=edit&columnsOnly='.$field.'&returnUrl='.rawurlencode($this->thisReturnUrl());
$PA['label'] = '<a href="'.htmlspecialchars($lTTS_url).'">'.$PA['label'].'</a>';
$label = '<a href="' . htmlspecialchars($lTTS_url) . '">' . $label . '</a>';
}
// wrap the label with help text
$PA['label'] = $label = t3lib_BEfunc::wrapInHelp($table, $field, $label);
// Create output value:
if ($PA['fieldConf']['config']['form_type']=='user' && $PA['fieldConf']['config']['noTableWrapping']) {
......
} elseif ($PA['palette']) {
// Array:
$out=array(
'NAME'=>$PA['label'],
'NAME' => $label,
'ID'=>$row['uid'],
'FIELD'=>$field,
'TABLE'=>$table,
'ITEM'=>$item,
'HELP_ICON' => $this->helpTextIcon($table,$field,1)
'ITEM'=>$item
);
$out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
} else {
// String:
$out=array(
'NAME'=>$PA['label'],
'NAME'=>$label,
'ITEM'=>$item,
'TABLE'=>$table,
'ID'=>$row['uid'],
'HELP_ICON'=>$this->helpTextIcon($table,$field),
'HELP_TEXT'=>$this->helpText($table,$field),
'PAL_LINK_ICON'=>$thePalIcon,
'FIELD'=>$field
);
......
// Wrapping a single field:
$this->fieldTemplate='
<tr ###BGCOLOR_HEAD######CLASSATTR_2###>
<td>###FIELD_HELP_ICON###</td>
<td width="99%"><span style="color:###FONTCOLOR_HEAD###;"###CLASSATTR_4###><strong>###FIELD_NAME###</strong></span>###FIELD_HELP_TEXT###</td>
<td>&nbsp;</td>
<td width="99%"><span style="color:###FONTCOLOR_HEAD###;"###CLASSATTR_4###><strong>###FIELD_NAME###</strong></span></td>
</tr>
<tr ###BGCOLOR######CLASSATTR_1###>
<td nowrap="nowrap"><img name="req_###FIELD_TABLE###_###FIELD_ID###_###FIELD_FIELD###" src="clear.gif" class="t3-TCEforms-reqImg" alt="" /><img name="cm_###FIELD_TABLE###_###FIELD_ID###_###FIELD_FIELD###" src="clear.gif" class="t3-TCEforms-contentchangedImg" alt="" /></td>
......
'</label>' .
'<span' . $fieldAttributes . '>' .
$content['ITEM'] .
$content['HELP_ICON'] .
'</span>' .
'</span>';
}
t3lib/class.t3lib_befunc.php (Arbeitskopie)
/**
* Returns help-text icon if configured for.
* TCA_DESCR must be loaded prior to this function and $BE_USER must have 'edit_showFieldHelp' set to 'icon', otherwise nothing is returned
* TCA_DESCR must be loaded prior to this function and $BE_USER must
* have 'edit_showFieldHelp' set to 'icon', otherwise nothing is returned
* Usage: 6
*
* Please note: since TYPO3 4.5 the UX team decided to not use CSH in its former way,
* but to wrap the given text (where before the help icon was, and you could hover over it)
* Please also note that since TYPO3 4.5 the option to enable help (none, icon only, full text)
* was completely removed.
*
* @param string Table name
* @param string Field name
......
if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && (isset($BE_USER->uc['edit_showFieldHelp']) || $force)) {
if ($BE_USER->uc['edit_showFieldHelp'] == 'icon') {
$text = self::helpText($table, $field, $BACK_PATH, '');
$text = self::helpText($table, $field);
$text = '<span class="typo3-csh-inline">' . $GLOBALS['LANG']->hscAndCharConv($text, FALSE) . '</span>';
}
return '<a class="typo3-csh-link" href="#" rel="' . $table . '.' . $field . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-help-open', array('class' => 'typo3-csh-icon')) . $text.'</a>';
......
*
* @param string Table name
* @param string Field name
* @param string Back path
* @param string Back path, deprecated since TYPO3 4.5, will be removed in TYPO3 4.7, because not used at all
* @param string DEPRECATED: Additional style-attribute content for wrapping table (now: only in function cshItem needed)
* @return string HTML content for help text
*/
public static function helpText($table, $field, $BACK_PATH, $styleAttrib = '') {
public static function helpText($table, $field, $BACK_PATH = '', $styleAttrib = '') {
global $TCA_DESCR, $BE_USER;
$output = '';
......
}
// add description text
if ($data['description'] || $arrow) {
$output = '<p class="t3-csh-short">' . nl2br(htmlspecialchars($data['description'])) . $arrow . '</p>';
$output = '<p class="t3-help-short">' . nl2br(htmlspecialchars($data['description'])) . $arrow . '</p>';
}
// put header before the rest of the text
......
return $output;
}
/**
* API function that wraps the text / html in help text, so if a user hovers over it
* the help text will show up
* This is the new help API function since TYPO3 4.5, and uses the new behaviour
* (hover over text, no icon, no fulltext option, no option to disable the help)
*
* @param string $table The table name for which the help should be shown
* @param string $field The field name for which the help should be shown
* @param string $text the text which should be wrapped with the help text
* @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);
if ($helpText) {
// if no text was given, just use the regular help icon
if ($text == '') {
$text = t3lib_iconWorks::getSpriteIcon('actions-system-help-open');
}
$helpText = '<span class="t3-help-inline">' . $GLOBALS['LANG']->hscAndCharConv($helpText, FALSE) . '</span>';
$text = '<abbr class="t3-help-teaser">' . $text . '</abbr>';
$text = '<a class="t3-help-link" href="#" rel="' . $table . '|' . $field . '">' . $text . $helpText . '</a>';
}
return $text;
}
/**
* API for getting CSH icons/text for use in backend modules.
typo3/template.php (Arbeitskopie)
$this->pageRenderer->addExtOnReadyCode('
Ext.getBody().on({
click: {
delegate: "a.typo3-csh-link",
delegate: "a",
scope:this,
fn:function(event, link) {
event.stopEvent();
top.TYPO3.ContextHelpWindow.open(link.rel);
var element = Ext.fly(link);
if (element.hasClass("typo3-csh-link") || element.hasClass("t3-help-link")) {
event.stopEvent();
top.TYPO3.ContextHelpWindow.open(link.rel);
}
}
}
});
typo3/stylesheets/structure/element_csh.css (Arbeitskopie)
a.typo3-csh-link:hover span.typo3-csh-inline {
display: block;
}
.t3-help-link span.t3-help-inline {
display: none;
}
a.t3-help-link:hover span.t3-help-inline {
display: block;
}
typo3/sysext/t3skin/stylesheets/structure/element_csh.css (Arbeitskopie)
div.typo3-view-help img.c-inlineimg {
margin-left: 10px;
}
/*** new help code ***/
.t3-help-teaser {
border-bottom: 1px dotted #434343;
}
table.t3-help-inline {
margin: 3px 4px 20px 0px;
padding: 0;
}
table.t3-help-inline a.t3-help-link {
float: none;
margin-right: 0;
}
a.t3-help-link .t3-help-inline {
display: none;
padding: 0px;
position: absolute;
width: 200px;
z-index: 100;
}
a.t3-help-link .t3-help-inline.show-right {
right: 10px;
}
table.t3-help-inline a.t3-help-link,
table.t3-help-inline span.t3-row-header,
span.t3-help-inline span.t3-row-header,
a.t3-help-link span.t3-help-inline span.t3-row-header {
display: block;
}
a.t3-help-link:hover .t3-help-inline {
display: block;
}
.t3-help-inline h2.t3-row-header {
margin: 0;
height: auto;
}
.t3-help-inline p.t3-help-short {
padding: 3px;
}
table.t3-help-inline a.t3-help-link {
height: 16px;
}
table.t3-help-inline tr td h4 {
margin-top: 0px;
margin-bottom: 0px;
}
table.t3-help-inline span.paragraph,
a.t3-help-link span.t3-help-inline span.paragraph {
display: block;
padding: 3px;
}
img.t3-help-icon {
vertical-align: middle;
}
div.t3-view-help h1 {
margin-bottom: 0px;
padding: 10px;
}
div.t3-view-help h2 {
margin-top: 0;
padding: 4px 2px 4px 10px;
}
div.t3-view-help h3 {
padding: 5px 10px;
}
div.t3-view-help h4 {
padding: 2px 10px;
}
div.t3-view-help {
margin: 0;
width: 100%;
}
div.t3-view-help p {
margin: 4px 4px 12px 10px;
}
div.t3-view-help div.c-toc {
padding-left: 6px;
}
div.t3-view-help div.c-toc p {
margin: 0;
}
div.t3-view-help div.c-toc ul {
padding: 2px 5px;
}
div.t3-view-help div.c-toc ul li ul {
margin-left: 10px;
}
div.t3-view-help div.c-toc ul li {
padding: 2px;
}
div.t3-view-help .manual-title,
div.t3-view-help .introduction {
padding: 0 12px 6px;
}
div.t3-view-help img.c-inlineimg {
margin-left: 10px;
}
typo3/sysext/t3skin/stylesheets/visual/element_csh.css (Arbeitskopie)
white-space: normal;
}
/** new CSH code **/
table.t3-help-inline {
background-color: #ffffff;
border: 1px solid #a2aab8;
}
.t3-help-inline {
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
line-height: 16px;
}
a.t3-help-link .t3-help-inline {
background: #ffffff;
color: #000000;
font-weight: normal;
}
div.t3-help-inline p.t3-help-short {
border: #b6b6b6 1px solid;
border-top: none;
}
img.t3-help-icon {
cursor: help;
}
a.t3-help-link {
white-space: normal;
}
/* view_help.php */
#typo3-view-help-php {
}
typo3/sysext/setup/ext_tables.php (Arbeitskopie)
'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_wideDocument',
'csh' => 'edit_wideDocument',
),
'edit_showFieldHelp' => array(
'type' => 'select',
'items' => array (
'0' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp_none',
'icon' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp_icon',
'text' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp_message',
),
'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp',
'csh' => 'edit_showFieldHelp',
),
'titleLen' => array(
'type' => 'text',
'label' => 'LLL:EXT:setup/mod/locallang.xml:maxTitleLen',
'csh' => 'maxTitleLen',
),
'edit_RTE' => array(
'type' => 'check',
'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_RTE',
(2-2/2)