Index: t3lib/class.t3lib_tceforms.php =================================================================== --- t3lib/class.t3lib_tceforms.php (Revision 9401) +++ t3lib/class.t3lib_tceforms.php (Arbeitskopie) @@ -1654,9 +1654,11 @@ $styleAttrValue = $this->optionTagStyle($p[2]); if ($sM) { list($selectIconFile,$selectIconInfo) = $this->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 (!empty($selectIconInfo)) { + $selectedStyle = ' class="typo3-TCEforms-select-selectedItemWithBackgroundImage" style="background-image:url(' . $selectIconFile . ');"'; + } else { + $selectedStyle = ' class="' . t3lib_iconWorks::getSpriteIconClasses($p[2]) . '"'; + } } } @@ -1685,18 +1687,25 @@ } } - // If there is an icon for the selector box (rendered in table under)...: + // If there is an icon for the selector box (rendered in selicon-table below)...: + // if there is an icon ($p[2]), icons should be shown, and, if only selected are visible, is it selected if ($p[2] && !$suppressIcons && (!$onlySelectedIconShown || $sM)) { list($selIconFile,$selIconInfo)=$this->getIcon($p[2]); - $iOnClick = $this->elName($PA['itemFormElName']) . '.selectedIndex=' . $c . '; ' . - $this->elName($PA['itemFormElName']) . '.style.backgroundImage=' . $this->elName($PA['itemFormElName']) . '.options[' . $c .'].style.backgroundImage; ' . - implode('',$PA['fieldChangeFunc']).$this->blur().'return false;'; + if (!empty($selIconInfo)) { + $iOnClick = $this->elName($PA['itemFormElName']) . '.selectedIndex=' . $c . '; ' . + $this->elName($PA['itemFormElName']) . '.style.backgroundImage=' . $this->elName($PA['itemFormElName']) . '.options[' . $c . '].style.backgroundImage; ' . + implode('', $PA['fieldChangeFunc']) . $this->blur() . 'return false;'; + } else { + $iOnClick = $this->elName($PA['itemFormElName']) . '.selectedIndex=' . $c . '; ' . + $this->elName($PA['itemFormElName']) . '.class=' . $this->elName($PA['itemFormElName']) . '.options[' . $c . '].class; ' . + implode('', $PA['fieldChangeFunc']) . $this->blur() . 'return false;'; + } $selicons[]=array( (!$onlySelectedIconShown ? '' : ''). - ''.htmlspecialchars($p[0]).''. + $this->getIconHtml($p[2], htmlspecialchars($p[0]), htmlspecialchars($p[0])) . (!$onlySelectedIconShown ? '' : ''), $c,$sM); - $onChangeIcon = 'this.style.backgroundImage=this.options[this.selectedIndex].style.backgroundImage;'; + } $c++; } @@ -1812,9 +1821,10 @@ } // Icon: - $selIconFile = ''; if ($p[2]) { - list($selIconFile,$selIconInfo) = $this->getIcon($p[2]); + $selIcon = $p[2]; + } else { + $selIcon = t3lib_iconWorks::getSpriteIcon('empty-empty'); } // Compile row: @@ -1847,7 +1857,7 @@ insertDefStyle('check').' name="'.htmlspecialchars($PA['itemFormElName'].'['.$c.']').'" value="'.htmlspecialchars($p[1]).'"'.$sM.' onclick="'.htmlspecialchars($sOnChange).'"'.$PA['onFocus'].' /> '. - ($selIconFile ? '' : ''). + $this->getIconHtml($selIcon) . $label . ' ' . (strcmp($p[3],'') ? $help : '') . ' @@ -3909,8 +3919,7 @@ // Title / icon: $iTitle = htmlspecialchars($this->sL($wConf['title'])); if ($wConf['icon']) { - $iDat = $this->getIcon($wConf['icon']); - $icon = ''; + $icon = $this->getIconHtml($wConf['icon'], $iTitle, $iTitle); } else { $icon = $iTitle; } @@ -4115,6 +4124,24 @@ } /** + * renders the $icon, supports a filename for skinImg or sprite-icon-name + * @param $icon the icon passed, could be a file-reference or a sprite Icon name + * @param string $alt alt attribute of the icon returned + * @param string $title title attribute of the icon return + * @return an tag representing to show the asked icon + */ + protected function getIconHtml($icon, $alt = '', $title = '') { + $iconArray = $this->getIcon($icon); + debug($icon); + debug($iconArray); + if(is_file(PATH_typo3 . $iconArray[0])) { + return '' . $alt . ''; + } else { + return t3lib_iconWorks::getSpriteIcon($icon,array('alt'=> $alt, 'title'=> $title)); + } + } + + /** * Creates style attribute content for option tags in a selector box, primarily setting it up to show the icon of an element as background image (works in mozilla) * * @param string Icon string for option item @@ -4570,7 +4597,7 @@ if (!$TCA[$theTableNames]['ctrl']['adminOnly']) { // Icon: - $icon = '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,t3lib_iconWorks::getIcon($theTableNames, array()),'',1); + $icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName($theTableNames, array()); // Add description texts: if ($this->edit_showFieldHelp) { @@ -4594,7 +4621,7 @@ foreach($theTypes as $theTypeArrays) { // Icon: - $icon = $theTypeArrays[1]!='--div--' ? '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,t3lib_iconWorks::getIcon('pages', array('doktype' => $theTypeArrays[1])),'',1) : ''; + $icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName('pages', array('doktype' => $theTypeArrays[1])); // Item configuration: $items[] = array( @@ -4622,7 +4649,7 @@ $items[] = array( rtrim($theTypeArrays[0], ':'), $theTypeArrays[1], - '', + 'empty-empty', $descr ); } @@ -4632,8 +4659,8 @@ // Icons: $icons = array( - 'ALLOW' => '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,'gfx/icon_ok2.gif','',1), - 'DENY' => '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,'gfx/icon_fatalerror.gif','',1), + 'ALLOW' => 'status-status-permission-granted', + 'DENY' => 'status-status-permission-denied', ); // Traverse types: @@ -4659,7 +4686,7 @@ } break; case 'languages': - $items = array_merge($items,t3lib_BEfunc::getSystemLanguages()); + $items = array_merge($items, t3lib_BEfunc::getSystemLanguages()); break; case 'custom': // Initialize: @@ -4678,7 +4705,6 @@ // Icon: if ($itemCfg[1]) { list($icon) = $this->getIcon($itemCfg[1]); - if ($icon) $icon = '../'.TYPO3_mainDir.$icon; } else $icon = ''; // Add item to be selected: @@ -4707,7 +4733,7 @@ // Icon: $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$theMod.'_tab']; if ($icon) { - $icon = '../'.substr($icon,strlen(PATH_site)); + $icon = '../' . substr($icon,strlen(PATH_site)); } // Description texts: @@ -4798,7 +4824,7 @@ $iParts = t3lib_div::trimExplode(',',$row[$iField],1); $icon = '../'.$iPath.'/'.trim($iParts[0]); } elseif (t3lib_div::inList('singlebox,checkbox',$fieldValue['config']['renderMode'])) { - $icon = '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,t3lib_iconWorks::getIcon($f_table, $row),'',1); + $icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName($f_table, $row); } else $icon = ''; // Add the item: @@ -5137,6 +5163,7 @@ '' . '' . $content['ITEM'] . + $content['HELP_ICON'] . '' . ''; } @@ -6263,7 +6290,15 @@ } } - return ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] ? '' : ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] ? '['.$this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'].']' : '')).' '; + $out = ''; + if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']) { + $out .= t3lib_iconWorks::getSpriteIcon($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']); + $out .= ' '; + } else if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title']) { + $out .= '[' . $this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] . ']'; + $out .= ' '; + } + return $out; } /** @@ -6303,9 +6338,16 @@ // Icon + clickmenu: $absFilePath = t3lib_div::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath); - $fI = pathinfo($imgPath); - $fileIcon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension'])); - $fileIcon = 'backPath,'gfx/fileicons/'.$fileIcon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].($absFilePath && @is_file($absFilePath) ? ' ('.t3lib_div::formatSize(filesize($absFilePath)).'bytes)' : ' - FILE NOT FOUND!')).'" alt="" />'; + $fileInformation = pathinfo($imgPath); + $fileIcon = t3lib_iconWorks::getSpriteIconForFile($imgPath, + array('title' => + htmlspecialchars($fileInformation['basename'] . + ($absFilePath && @is_file($absFilePath) ? + ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : + ' - FILE NOT FOUND!') + ) + ) + ); $imgs[] = ''.t3lib_BEfunc::thumbCode($rowCopy,$table,$field,$this->backPath,'thumbs.php',$config['config']['uploadfolder'],0,' align="middle"'). ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon). Index: typo3/sysext/t3skin/stylesheets/visual/element_tceforms.css =================================================================== --- typo3/sysext/t3skin/stylesheets/visual/element_tceforms.css (Revision 9401) +++ typo3/sysext/t3skin/stylesheets/visual/element_tceforms.css (Arbeitskopie) @@ -433,3 +433,10 @@ .t3-form-field-add-flexsection { border-top: 1px solid #cdcdcd; } + +.typo3-TCEforms-select-selectedItemWithBackgroundImage { + background-color:#fff; + background-position: 0% 50%; + background-repeat:no-repeat; + padding:1px 1px 1px 24px; +}