Index: t3lib/class.t3lib_tceforms_inline.php =================================================================== --- t3lib/class.t3lib_tceforms_inline.php (Revision 8737) +++ t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie) @@ -831,16 +831,64 @@ // 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[]= ''; + + // Compiling the ' . LF; + $optGroupOpen = true; + $c--; + $optGroupStart = array(); + } + $opt[]= '' . 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 ? '' : ''). + ''.htmlspecialchars($p[0]).''. + (!$onlySelectedIconShown ? '' : ''), + $c,$sM); + $onChangeIcon = 'this.style.backgroundImage=this.options[this.selectedIndex].style.backgroundImage;'; + } + $c++; } // Put together the selector box: @@ -869,6 +917,27 @@ ''. t3lib_iconWorks::getSpriteIcon('actions-document-new', array('title' => $createNewRelationText)) . $createNewRelationText . ''; + + // Create icon table: + if (count($selicons) && !$config['noIconsBelowSelect']) { + $item.=''; + $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.=''; + 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.=''; + $item.=''; + } + $item.=''; + } + $item.='
'.$selicons[$sk][0].'
'; + } // wrap the selector and add a spacer to the bottom $item = '
'.$item.'
'; }