Index: t3lib/class.t3lib_tceforms.php =================================================================== --- t3lib/class.t3lib_tceforms.php (Revision 9392) +++ 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 = ' style="background: #fff url(' . $selectIconFile . ') 0% 50% no-repeat; padding: 1px 1px 1px 24px;"'; + } else { + $selectedStyle = ' classes="' . 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 shoulhd 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 : '') . ' @@ -4570,7 +4580,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 +4604,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 +4632,7 @@ $items[] = array( rtrim($theTypeArrays[0], ':'), $theTypeArrays[1], - '', + 'empty-empty', $descr ); } @@ -4632,8 +4642,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 +4669,7 @@ } break; case 'languages': - $items = array_merge($items,t3lib_BEfunc::getSystemLanguages()); + $items = array_merge($items, t3lib_BEfunc::getSystemLanguages()); break; case 'custom': // Initialize: @@ -4678,7 +4688,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 +4716,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 +4807,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 +5146,7 @@ '' . '' . $content['ITEM'] . + $content['HELP_ICON'] . '' . ''; } @@ -6303,9 +6313,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). @@ -6453,6 +6470,22 @@ public function addStyleSheet($key, $href, $title='', $relation='stylesheet') { $GLOBALS['SOBE']->doc->addStyleSheet($key, $href, $title, $relation); } + + /** + * 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); + if(is_file(PATH_typo3 . $iconArray[0])) { + return '' . $alt . ''; + } else { + return t3lib_iconWorks::getSpriteIcon($icon,array('alt'=> $alt, 'title'=> $title)); + } + } }