Project

General

Profile

Bug #23547 » typo3core_bugfix_15725_trunk_v2.patch

Administrator Admin, 2010-09-16 22:44

View differences:

t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie)
// Create option tags:
$opt = array();
$styleAttrValue = '';
foreach($selItems as $p) {
$sM = (!strcmp($PA['itemFormElValue'],$p[1])?' selected="selected"':'');
if ($sM) {
$sI = $c;
$noMatchingValue = 0;
}
// Getting style attribute value (for icons):
if ($config['iconsInOptionTags']) {
$styleAttrValue = $this->fObj->optionTagStyle($p[2]);
if ($sM) {
list($selectIconFile,$selectIconInfo) = $this->fObj->getIcon($p[2]);
if (!empty($selectIconInfo)) {
$selectedStyle = ' style="background: #fff url(' . $selectIconFile . ') 0% 50% no-repeat; padding: 1px 1px 1px 24px; -webkit-background-size: 0;"';
}
}
}
if (!in_array($p[1], $uniqueIds)) {
$opt[]= '<option value="'.htmlspecialchars($p[1]).'"'.
' style="'.(in_array($p[1], $uniqueIds) ? '' : '').
($styleAttrValue ? ' style="'.htmlspecialchars($styleAttrValue) : '').'">'.
htmlspecialchars($p[0]).'</option>';
// Compiling the <option> tag:
if (!($p[1] != $PA['itemFormElValue'] && is_array($uniqueIds) && in_array($p[1], $uniqueIds))) {
if(!strcmp($p[1],'--div--')) {
$optGroupStart[0] = $p[0];
$optGroupStart[1] = $styleAttrValue;
} else {
if (count($optGroupStart)) {
if($optGroupOpen) { // Closing last optgroup before next one starts
$opt[]='</optgroup>' . LF;
}
$opt[]= '<optgroup label="'.t3lib_div::deHSCentities(htmlspecialchars($optGroupStart[0])).'"'.
($optGroupStart[1] ? ' style="'.htmlspecialchars($optGroupStart[1]).'"' : '').
' class="c-divider">' . LF;
$optGroupOpen = true;
$c--;
$optGroupStart = array();
}
$opt[]= '<option value="'.htmlspecialchars($p[1]).'"'.
$sM.
($styleAttrValue ? ' style="'.htmlspecialchars($styleAttrValue).'"' : '').
'>' . t3lib_div::deHSCentities(($p[0])) . '</option>' . LF;
}
}
// If there is an icon for the selector box (rendered in table under)...:
if ($p[2] && !$suppressIcons && (!$onlySelectedIconShown || $sM)) {
list($selIconFile,$selIconInfo)=$this->fObj->getIcon($p[2]);
$iOnClick = $this->fObj->elName($this->inlineNames['object'] . self::Structure_Separator . $conf['foreign_table'] . '_selector') . '.selectedIndex=' . $c . '; ' .
$this->fObj->elName($this->inlineNames['object'] . self::Structure_Separator . $conf['foreign_table'] . '_selector') . '.onchange();' .
implode('',$PA['fieldChangeFunc']).$this->fObj->blur().'return false;';
$selicons[]=array(
(!$onlySelectedIconShown ? '<a href="#" onclick="'.htmlspecialchars($iOnClick).'">' : '').
'<img src="'.$selIconFile.'" '.$selIconInfo[3].' vspace="2" border="0" title="'.htmlspecialchars($p[0]).'" alt="'.htmlspecialchars($p[0]).'" />'.
(!$onlySelectedIconShown ? '</a>' : ''),
$c,$sM);
$onChangeIcon = 'this.style.backgroundImage=this.options[this.selectedIndex].style.backgroundImage;';
}
$c++;
}
// Put together the selector box:
......
'<a href="#" onclick="'.htmlspecialchars($onChange).'" align="abstop">'.
t3lib_iconWorks::getSpriteIcon('actions-document-new', array('title' => $createNewRelationText)) . $createNewRelationText .
'</a>';
// Create icon table:
if (count($selicons) && !$config['noIconsBelowSelect']) {
$item.='<table border="0" cellpadding="0" cellspacing="0" class="typo3-TCEforms-selectIcons">';
$selicon_cols = intval($config['selicon_cols']);
if (!$selicon_cols) $selicon_cols=count($selicons);
$sR = ceil(count($selicons)/$selicon_cols);
$selicons = array_pad($selicons,$sR*$selicon_cols,'');
for($sa=0;$sa<$sR;$sa++) {
$item.='<tr>';
for($sb=0;$sb<$selicon_cols;$sb++) {
$sk=($sa*$selicon_cols+$sb);
$imgN = 'selIcon_'.$table.'_'.$row['uid'].'_'.$field.'_'.$selicons[$sk][1];
$imgS = ($selicons[$sk][2]?$this->backPath.'gfx/content_selected.gif':'clear.gif');
$item.='<td><img name="'.htmlspecialchars($imgN).'" src="'.$imgS.'" width="7" height="10" alt="" /></td>';
$item.='<td>'.$selicons[$sk][0].'</td>';
}
$item.='</tr>';
}
$item.='</table>';
}
// wrap the selector and add a spacer to the bottom
$item = '<div style="margin-bottom: 20px;">'.$item.'</div>';
}
(2-2/2)