Project

General

Profile

Bug #24418 ยป 16848.diff

Administrator Admin, 2011-01-14 13:07

View differences:

t3lib/class.t3lib_tceforms.php (working copy)
$lang = 'l' . $lKey; // Default language, other options are "lUK" or whatever country code (independant of system!!!)
$PA['_valLang'] = $langChildren && !$langDisabled ? $editData['meta']['currentLangId'] : 'DEF'; // Default language, other options are "lUK" or whatever country code (independant of system!!!)
$PA['_lang'] = $lang;
$PA['_cshFile'] = ((isset($dataStruct['ROOT']['TCEforms']) && isset($dataStruct['ROOT']['TCEforms']['cshFile'])) ? $dataStruct['ROOT']['TCEforms']['cshFile'] : '');
// Assemble key for loading the correct CSH file
$dsPointerFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['ds_pointerField'], TRUE);
$PA['_cshKey'] = $table . '.' . $field;
foreach ($dsPointerFields as $key) {
$PA['_cshKey'] .= '.' . $row[$key];
}
// Push the sheet level tab to DynNestedStack
if (is_array($dataStructArray['sheets'])) {
......
$processedTitle = str_replace('\n', '<br />', $theTitle);
$tRows[] = '<div class="t3-form-field-container t3-form-field-container-flex">' .
'<div class="t3-form-field-label t3-form-field-label-flex">' .
$this->helpTextIcon_typeFlex($key, $processedTitle, $PA['_cshFile']) .
$languageIcon .
$processedTitle .
t3lib_BEfunc::wrapInHelp($PA['_cshKey'], $key, $processedTitle) .
'</div>
<div class="t3-form-field t3-form-field-flex">' . $theFormEl . $defInfo . $this->renderVDEFDiff($editData[$key], $vDEFkey) . '</div>
</div>';
......
* @param string Field title
* @param string File name with CSH labels
* @return string HTML, <a>-tag with
* @deprecated since TYPO3 4.5, this function will be removed in TYPO3 4.7. Use t3lib_BEfunc::wrapInHelp() instead.
*/
function helpTextIcon_typeFlex($field, $fieldTitle, $cshFile) {
t3lib_div::logDeprecatedFunction();
if ($this->globalShowHelp && $cshFile) {
$value = $GLOBALS['LANG']->sL($cshFile . ':' . $field . '.description');
if (trim($value)) {
......
* @param string Field name
* @param string CSH file name
* @return string Description for the field with cion or empty string
* @deprecated since TYPO3 4.5, this function will be removed in TYPO3 4.7. Use t3lib_BEfunc::wrapInHelp() instead.
*/
function helpText_typeFlex($field, $fieldTitle, $cshFile) {
t3lib_div::logDeprecatedFunction();
if ($this->globalShowHelp && $cshFile && $this->edit_showFieldHelp == 'text') {
$value = $GLOBALS['LANG']->sL($cshFile . ':' . $field . '.description');
if (trim($value)) {
typo3/view_help.php (working copy)
var $limitAccess; // If set access to fields and tables is checked. Should be done for true database tables.
var $table; // The "table" key
var $field; // The "field" key
/**
* Key used to point to the right CSH resource
* In simple cases, is equal to $table
*
* @var string
*/
protected $mainKey;
// Internal, static: GPvar:
var $tfID; // Table/FIeld id.
......
$this->renderALL = t3lib_div::_GP('renderALL');
// Set internal table/field to the parts of "tfID" incoming var.
list($this->table,$this->field) = explode('.',$this->tfID);
$identifierParts = explode('.', $this->tfID);
// The table is the first item
$this->table = array_shift($identifierParts);
$this->mainKey = $this->table;
// The field is the second one
$this->field = array_shift($identifierParts);
// There may be extra parts for FlexForms
if (count($identifierParts) > 0) {
$flexFormField = array_pop($identifierParts);
$extraIdentifierInformation = $identifierParts;
// Assemble a different main key and switch field to use flexform field name
$this->mainKey .= '.' . $this->field;
foreach ($extraIdentifierInformation as $extraKey) {
$this->mainKey .= '.' . $extraKey;
}
$this->field = $flexFormField;
}
// limitAccess is checked if the $this->table really IS a table (and if the user is NOT a translator who should see all!)
$showAllToUser = t3lib_BEfunc::isModuleSetInTBE_MODULES('txllxmltranslateM1') && $GLOBALS['BE_USER']->check('modules','txllxmltranslateM1');
......
// Start HTML output accumulation:
$TBE_TEMPLATE->divClass = 'typo3-view-help';
$this->content.= $TBE_TEMPLATE->startPage($LANG->getLL('title'));
$this->content .= $TBE_TEMPLATE->startPage($LANG->getLL('title'));
if ($this->field=='*') { // If ALL fields is supposed to be shown:
if ($this->field == '*') {
// If ALL fields is supposed to be shown:
$this->createGlossaryIndex();
$this->content.= $this->render_Table($this->table);
} elseif ($this->tfID) { // ... otherwise show only single field:
$this->content .= $this->render_Table($this->mainKey);
} elseif ($this->tfID) {
// ... otherwise show only single field:
$this->createGlossaryIndex();
$this->content.= $this->render_Single($this->table,$this->field);
}
elseif (is_array($this->ffID)) {
$this->content.= $this->render_SingleFlex();
} else { // Render Table Of Contents if nothing else:
$this->content .= $this->render_Single($this->mainKey, $this->field);
} elseif (is_array($this->ffID)) {
$this->content .= $this->render_SingleFlex();
} else {
// Render Table Of Contents if nothing else:
$this->content.= $this->render_TOC();
}
......
/**
* Render CSH for a full cshKey/table
*
* @param string CSH key / table name
* @return string HTML output
* @param string $key Full CSH key (may be different from table name)
* @param string $table CSH key / table name
* @return string HTML output
*/
function render_Table($table) {
function render_Table($key, $table) {
global $BE_USER,$TCA_DESCR,$TCA,$LANG;
$output = '';
// Load table TCA
t3lib_div::loadTCA($table);
t3lib_div::loadTCA($key);
// Load descriptions for table $table
$LANG->loadSingleTableDescription($table);
$LANG->loadSingleTableDescription($key);
if (is_array($TCA_DESCR[$table]['columns']) && (!$this->limitAccess || $BE_USER->check('tables_select',$table))) {
if (is_array($TCA_DESCR[$key]['columns']) && (!$this->limitAccess || $BE_USER->check('tables_select', $table))) {
// Initialize variables:
$parts = array();
$parts[0] = ''; // Reserved for header of table
// Traverse table columns as listed in TCA_DESCR
foreach ($TCA_DESCR[$table]['columns'] as $field => $value) {
foreach ($TCA_DESCR[$key]['columns'] as $field => $_) {
$fieldValue = isset($TCA[$table]) && strcmp($field,'') ? $TCA[$table]['columns'][$field] : array();
$fieldValue = isset($TCA[$key]) && strcmp($field, '') ? $TCA[$key]['columns'][$field] : array();
if (is_array($fieldValue) && (!$this->limitAccess || !$fieldValue['exclude'] || $BE_USER->check('non_exclude_fields',$table.':'.$field))) {
if (is_array($fieldValue) && (!$this->limitAccess || !$fieldValue['exclude'] || $BE_USER->check('non_exclude_fields', $table . ':' . $field))) {
if (!$field) {
$parts[0] = $this->printItem($table,'',1); // Header
$parts[0] = $this->printItem($key, '', 1); // Header
} else {
$parts[] = $this->printItem($table,$field,1); // Field
$parts[] = $this->printItem($key, $field, 1); // Field
}
}
}
......
if (!$parts[0]) {
unset($parts[0]);
}
$output.= implode('<br />',$parts);
$output .= implode('<br />', $parts);
}
// Substitute glossary words:
$output = $this->substituteGlossaryWords($output);
// TOC link:
if (!$this->renderALL) {
$tocLink = '<p class="c-nav"><a href="view_help.php">'.$LANG->getLL('goToToc',1).'</a></p>';
if (!$this->renderALL) {
$tocLink = '<p class="c-nav"><a href="view_help.php">' . $LANG->getLL('goToToc', 1) . '</a></p>';
$output =
$tocLink.'
......
/**
* Renders CSH for a single field.
*
* @param string CSH key / table name
* @param string Sub key / field name
* @return string HTML output
* @param string $key CSH key / table name
* @param string $field Sub key / field name
* @return string HTML output
*/
function render_Single($table,$field) {
function render_Single($key, $field) {
global $LANG, $TCA;
$output = '';
// Load descriptions for table $table
$LANG->loadSingleTableDescription($table);
// Load the description field
$LANG->loadSingleTableDescription($key);
// Render single item:
$output.= $this->printItem($table,$field);
// Render single item
$output.= $this->printItem($key, $field);
// Substitute glossary words:
$output = $this->substituteGlossaryWords($output);
......
// Link to Full table description and TOC:
$getLLKey = $this->limitAccess ? 'fullDescription' : 'fullDescription_module';
$output.= '<br />
<p class="c-nav"><a href="view_help.php?tfID='.rawurlencode($table.'.*').'">'.$LANG->getLL($getLLKey,1).'</a></p>
<p class="c-nav"><a href="view_help.php">'.$LANG->getLL('goToToc',1).'</a></p>';
<p class="c-nav"><a href="view_help.php?tfID=' . rawurlencode($key . '.*') . '">' . $LANG->getLL($getLLKey, 1) . '</a></p>
<p class="c-nav"><a href="view_help.php">' . $LANG->getLL('goToToc', 1) . '</a></p>';
return $output;
}
......
* @param string CSH key / table name
* @param string Sub key / field name
* @return string HTML output
* @deprecated since TYPO3 4.5, this function will be removed in TYPO3 4.7. Use render_Single() instead.
*/
function render_SingleFlex() {
t3lib_div::logDeprecatedFunction();
$output = '';
// Render
......
* Prints a single $table/$field information piece
* If $anchors is set, then seeAlso references to the same table will be page-anchors, not links.
*
* @param string Table name
* @param string Field name
* @param boolean If anchors is to be shown.
* @return string HTML content
* @param string $key CSH key / table name
* @param string $field Sub key / field name
* @param boolean $anchors If anchors is to be shown.
* @return string HTML content
*/
function printItem($table,$field,$anchors=0) {
function printItem($key, $field, $anchors = FALSE) {
global $TCA_DESCR, $LANG, $TCA, $BE_USER;
$out = '';
// Load full table definition in $TCA
t3lib_div::loadTCA($table);
t3lib_div::loadTCA($key);
if ($table && (!$field || is_array($TCA_DESCR[$table]['columns'][$field]))) {
if ($key && (!$field || is_array($TCA_DESCR[$key]['columns'][$field]))) {
// Make seeAlso references.
$seeAlsoRes = $this->make_seeAlso($TCA_DESCR[$table]['columns'][$field]['seeAlso'],$anchors?$table:'');
$seeAlsoRes = $this->make_seeAlso($TCA_DESCR[$key]['columns'][$field]['seeAlso'], $anchors ? $key : '');
// Making item:
$out= '<a name="'.$table.'.'.$field.'"></a>
'.
$this->headerLine($this->getTableFieldLabel($table,$field),1).
$this->prepareContent($TCA_DESCR[$table]['columns'][$field]['description']).
($TCA_DESCR[$table]['columns'][$field]['details'] ? $this->headerLine($LANG->getLL('details').':').$this->prepareContent($TCA_DESCR[$table]['columns'][$field]['details']) : '').
($TCA_DESCR[$table]['columns'][$field]['syntax'] ? $this->headerLine($LANG->getLL('syntax').':').$this->prepareContent($TCA_DESCR[$table]['columns'][$field]['syntax']) : '').
($TCA_DESCR[$table]['columns'][$field]['image'] ? $this->printImage($TCA_DESCR[$table]['columns'][$field]['image'],$TCA_DESCR[$table]['columns'][$field]['image_descr']) : '').
($TCA_DESCR[$table]['columns'][$field]['seeAlso'] && $seeAlsoRes ? $this->headerLine($LANG->getLL('seeAlso').':').'<p>'.$seeAlsoRes.'</p>' : '').
($this->back ? '<br /><p><a href="'.htmlspecialchars('view_help.php?tfID='.rawurlencode($this->back)).'" class="typo3-goBack">'.htmlspecialchars($LANG->getLL('goBack')).'</a></p>' : '').
'<br />';
$out = '<a name="' . $key . '.' . $field . '"></a>' .
$this->headerLine($this->getTableFieldLabel($key, $field), 1) .
$this->prepareContent($TCA_DESCR[$key]['columns'][$field]['description']) .
($TCA_DESCR[$key]['columns'][$field]['details'] ? $this->headerLine($LANG->getLL('details').':').$this->prepareContent($TCA_DESCR[$key]['columns'][$field]['details']) : '') .
($TCA_DESCR[$key]['columns'][$field]['syntax'] ? $this->headerLine($LANG->getLL('syntax').':').$this->prepareContent($TCA_DESCR[$key]['columns'][$field]['syntax']) : '') .
($TCA_DESCR[$key]['columns'][$field]['image'] ? $this->printImage($TCA_DESCR[$key]['columns'][$field]['image'],$TCA_DESCR[$key]['columns'][$field]['image_descr']) : '') .
($TCA_DESCR[$key]['columns'][$field]['seeAlso'] && $seeAlsoRes ? $this->headerLine($LANG->getLL('seeAlso').':').'<p>'.$seeAlsoRes.'</p>' : '') .
($this->back ? '<br /><p><a href="' . htmlspecialchars('view_help.php?tfID=' . rawurlencode($this->back)) . '" class="typo3-goBack">' . htmlspecialchars($LANG->getLL('goBack')) . '</a></p>' : '') .
'<br />';
}
return $out;
}
......
* @param string Field name
* @param boolean If anchors is to be shown.
* @return string HTML content
* @deprecated since TYPO3 4.5, this function will be removed in TYPO3 4.7. Use printItem() instead.
*/
function printItemFlex() {
t3lib_div::logDeprecatedFunction();
// Get all texts
foreach (explode(',', 'description,details,syntax,image,image_descr,seeAlso') as $var) {
// Double $ below is not a error!
......
}
/**
* Returns labels for $table and $field.
* If $table is "_MOD_" prefixed, the part after "_MOD_" is returned (non-tables, fx. modules)
* Returns labels for a given field in a given structure
*
* @param string Table name
* @param string Field name
* @return array Table and field labels in a numeric array
* @param string $key CSH key / table name
* @param string $field Sub key / field name
* @return array Table and field labels in a numeric array
*/
function getTableFieldNames($table,$field) {
function getTableFieldNames($key, $field) {
global $TCA, $TCA_DESCR, $LANG;
$LANG->loadSingleTableDescription($table);
$LANG->loadSingleTableDescription($key);
$tableName = is_array($TCA_DESCR[$table]['columns']['']) && $TCA_DESCR[$table]['columns']['']['alttitle'] ?
$TCA_DESCR[$table]['columns']['']['alttitle'] :
(isset($TCA[$table]) ? $TCA[$table]['ctrl']['title'] : preg_replace('/^_MOD_/','',$table));
$fieldName = is_array($TCA_DESCR[$table]['columns'][$field]) && $TCA_DESCR[$table]['columns'][$field]['alttitle'] ?
$TCA_DESCR[$table]['columns'][$field]['alttitle'] :
(isset($TCA[$table])&&isset($TCA[$table]['columns'][$field]) ? $TCA[$table]['columns'][$field]['label'] : $field);
return array($tableName,$fieldName);
// Define the label for the key
$keyName = $key;
if (is_array($TCA_DESCR[$key]['columns']['']) && isset($TCA_DESCR[$key]['columns']['']['alttitle'])) {
// If there's an alternative title, use it
$keyName = $TCA_DESCR[$key]['columns']['']['alttitle'];
} elseif (isset($TCA[$key])) {
// Otherwise, if it's a table, use its title
$keyName = $TCA[$key]['ctrl']['title'];
} else {
// If no title was found, make sure to remove any "_MOD_"
$keyName = preg_replace('/^_MOD_/', '', $key);
}
// Define the label for the field
$fieldName = $field;
if (is_array($TCA_DESCR[$key]['columns'][$field]) && isset($TCA_DESCR[$key]['columns'][$field]['alttitle'])) {
// If there's an alternative title, use it
$fieldName = $TCA_DESCR[$key]['columns'][$field]['alttitle'];
} elseif (isset($TCA[$key])&&isset($TCA[$key]['columns'][$field])) {
// Otherwise, if it's a table, use its title
$fieldName = $TCA[$key]['columns'][$field]['label'];
}
return array($keyName, $fieldName);
}
/**
* Returns composite label for table/field
*
* @param string Table name
* @param string Field name
* @param string Token to merge the two strings with.
* @return array Table and field labels in a numeric array
* @param string $key CSH key / table name
* @param string $field Sub key / field name
* @param string $mergeToken Token to merge the two strings with
* @return string Labels joined with merge token
* @see getTableFieldNames()
*/
function getTableFieldLabel($table,$field='',$mergeToken=': ') {
function getTableFieldLabel($key, $field = '', $mergeToken = ': ') {
global $LANG;
$tableName = '';
$fieldName = '';
// Get table / field parts:
list($tableName,$fieldName) = $this->getTableFieldNames($table,$field);
list($tableName, $fieldName) = $this->getTableFieldNames($key, $field);
// Create label:
$labelStr = $LANG->sL($tableName).
($field ? $mergeToken.rtrim(trim($LANG->sL($fieldName)), ':'):'');
$labelString = $LANG->sL($tableName) .
($field ? $mergeToken . rtrim(trim($LANG->sL($fieldName)), ':') : '');
return $labelStr;
return $labelString;
}
    (1-1/1)