Project

General

Profile

Feature #17943 » flexforms_csh.patch

Administrator Admin, 2007-12-20 12:45

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'] : '');
// Render flexform:
$tRows = $this->getSingleField_typeFlex_draw(
......
// Put row together
// possible linebreaks in the label through xml: \n => <br/>, usage of nl2br() not possible, so it's done through str_replace
$processedTitle = str_replace('\n', '<br />', $theTitle);
$tRows[]='<div>
<div class="bgColor5">'.($vDEFkey=='vDEF' ? '' : $this->getLanguageIcon($table,$row,$vDEFkey)).str_replace('\n', '<br />', $theTitle).'</div>
<div class="bgColor5">'.$this->helpTextIcon_typeFlex($key, $processedTitle, $PA['_cshFile']).($vDEFkey=='vDEF' ? '' : $this->getLanguageIcon($table,$row,$vDEFkey)).$processedTitle.'</div>
<div class="bgColor4">'.$theFormEl.$defInfo.$this->renderVDEFDiff($editData[$key],$vDEFkey).'</div>
</div>';
}
......
}
/**
* Returns help-text ICON if configured for.
*
* @param string Field name
* @param string Field title
* @param string File name with CSH labels
* @return string HTML, <a>-tag with
*/
function helpTextIcon_typeFlex($field, $fieldTitle, $cshFile) {
if ($this->globalShowHelp && $cshFile) {
$value = $GLOBALS['LANG']->sL($cshFile . ':' . $field . '.description');
if (trim($value)) {
if (substr($fieldTitle, -1, 1) == ':') {
$fieldTitle = substr($fieldTitle, 0, strlen($fieldTitle) - 1);
}
// CSH exists
$params = base64_encode(serialize(array(
'cshFile' => $cshFile,
'field' => $field,
'title' => $fieldTitle
)));
$aOnClick = 'vHWin=window.open(\''.$this->backPath.'view_help.php?ffID=' . $params . '\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/helpbubble.gif','width="14" height="14"').' hspace="2" border="0" class="absmiddle"'.($GLOBALS['CLIENT']['FORMSTYLE']?' style="cursor:help;"':'').' alt="" />'.
'</a>';
}
}
return '';
}
/**
* Setting the current color scheme ($this->colorScheme) based on $this->defColorScheme plus input string.
*
* @param string A color scheme string.
typo3/view_help.php (working copy)
// Internal, static: GPvar:
var $tfID; // Table/FIeld id.
var $ffID; // Flexform file/field information
var $back; // Back (previous tfID)
var $renderALL; // If set, then in TOC mode the FULL manual will be printed as well!
......
// Setting GPvars:
$this->tfID = t3lib_div::_GP('tfID');
if (!$this->tfID) {
if (($this->ffID = t3lib_div::_GP('ffID'))) {
$this->ffID = unserialize(base64_decode($this->ffID));
}
}
$this->back = t3lib_div::_GP('back');
$this->renderALL = t3lib_div::_GP('renderALL');
......
} 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_TOC();
}
......
}
/**
* Renders CSH for a single field.
*
* @param string CSH key / table name
* @param string Sub key / field name
* @return string HTML output
*/
function render_SingleFlex() {
$output = '';
// Render
$output.= $this->printItemFlex();
// Substitute glossary words:
return $this->substituteGlossaryWords($output);
}
/************************************
*
* Rendering CSH items
......
$imgArray = t3lib_div::trimExplode(',', $images, 1);
if (count($imgArray)) {
$descrArray = explode(chr(10),$descr,count($imgArray));
#debug($descrArray);
foreach($imgArray as $k => $image) {
$descr = $descrArray[$k];
......
}
/**
* 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
*/
function printItemFlex() {
// Get all texts
foreach (explode(',', 'description,details,syntax,image,image_descr,seeAlso') as $var) {
// Double $ below is not a error!
$$var = $GLOBALS['LANG']->sL($this->ffID['cshFile'] . ':' . $this->ffID['field'] . '.' . $var);
}
// Make seeAlso references.
$seeAlsoRes = $this->make_seeAlso($seeAlso);
// Making item:
$out= $this->headerLine($this->ffID['title'], 1) .
$this->prepareContent($description) .
($details ? $this->headerLine($GLOBALS['LANG']->getLL('details').':') . $this->prepareContent($details) : '') .
($syntax ? $this->headerLine($GLOBALS['LANG']->getLL('syntax').':') . $this->prepareContent($syntax) : '') .
($image ? $this->printImage($image, $image_descr) : '') .
($seeAlso && $seeAlsoRes ? $this->headerLine($GLOBALS['LANG']->getLL('seeAlso').':').'<p>'.$seeAlsoRes.'</p>' : '') .
'<br />';
return $out;
}
/**
* Returns labels for $table and $field.
* If $table is "_MOD_" prefixed, the part after "_MOD_" is returned (non-tables, fx. modules)
*
(1-1/2)