Feature #6710: Use optgroups in selectorboxes
authorIngmar Schlecht <ingmar.schlecht@typo3.org>
Wed, 14 Nov 2007 14:34:37 +0000 (14:34 +0000)
committerIngmar Schlecht <ingmar.schlecht@typo3.org>
Wed, 14 Nov 2007 14:34:37 +0000 (14:34 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2705 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php
typo3/stylesheet.css

index 37516ef..56b6bfb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * Cleanup-up to prior commit #529: "TypoScript help" module
        * Added SVN properties to new files
        * Minor changes to feature #6670: Enable Tabs in Page Properties
+       * Feature #6710: Use optgroups in selectorboxes
 
 2007-11-14  Ingo Renner        <ingo@typo3.org>
 
index d4bc1db..2bd50e4 100755 (executable)
@@ -1511,11 +1511,20 @@ class t3lib_TCEforms    {
 
                                // Compiling the <option> tag:
                        if (!($p[1] != $PA['itemFormElValue'] && is_array($uniqueIds) && in_array($p[1], $uniqueIds))) {
-                               $opt[]= '<option value="'.htmlspecialchars($p[1]).'"'.
+                               if(!strcmp($p[1],'--div--')) {
+                                       if($optGroupOpen) { // Closing last optgroup before next one starts
+                                               $opt[]='</optgroup>';
+                                       }
+                                       $opt[]= '<optgroup label="'.t3lib_div::deHSCentities(htmlspecialchars($p[0])).'"'.
+                                                       ($styleAttrValue ? ' style="'.htmlspecialchars($styleAttrValue).'"' : '').
+                                                       ' class="c-divider">';  
+                                       $optGroupOpen = true;
+                               } else {
+                                       $opt[]= '<option value="'.htmlspecialchars($p[1]).'"'.
                                                        $sM.
                                                        ($styleAttrValue ? ' style="'.htmlspecialchars($styleAttrValue).'"' : '').
-                                                       (!strcmp($p[1],'--div--') ? ' class="c-divider"' : '').
                                                        '>'.t3lib_div::deHSCentities(htmlspecialchars($p[0])).'</option>';
+                               }
                        }
 
                                // If there is an icon for the selector box (rendered in table under)...:
@@ -1531,6 +1540,11 @@ class t3lib_TCEforms     {
                        $c++;
                }
 
+               if($optGroupOpen) { // Closing optgroup if open
+                       $opt[]='</optgroup>';
+                       $optGroupOpen = false;
+               }
+
                        // No-matching-value:
                if ($PA['itemFormElValue'] && $noMatchingValue && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement'])  {
                        $nMV_label = @sprintf($nMV_label, $PA['itemFormElValue']);
index a9c14c2..43be5e3 100755 (executable)
@@ -281,7 +281,8 @@ TABLE.typo3-TCEforms SPAN.typo3-TCEforms-recHeader { font-weight: bold; color: #
 table.typo3-TCEforms tr.typo3-TCEforms-recHeaderRow, TABLE.typo3-TCEforms tr.typo3-TCEforms-recHeaderRow td { border: 0; }
 TABLE.typo3-TCEforms SPAN.typo3-TCEforms-newToken { font-weight: bold; color: #990000; }
 TABLE.typo3-TCEforms SPAN.typo3-TCEforms-helpText { color: #666; }
-TABLE.typo3-TCEforms OPTION.c-divider { font-style: italic; color: #666; background-color: #eee; text-transform: uppercase; margin-top: 10px; border-bottom: 1px solid #666; }
+TABLE.typo3-TCEforms OPTGROUP.c-divider { font-style: italic; color: #666; background-color: #eee; text-transform: uppercase; margin-top: 10px; padding: 0px; border-top: 1px solid #666; }
+TABLE.typo3-TCEforms OPTGROUP OPTION { font-style: normal; color: black; background-color: white; text-transform: none; border-bottom: none; padding: 0px; margin: 0px; text-indent: 0px;}
 TABLE.typo3-TCEforms TABLE.typo3-TCEforms-select-checkbox TR.c-selectedItem { background-color: #c5c1b5; }
 TABLE.typo3-TCEforms TABLE.typo3-TCEforms-select-checkbox TR.c-invalidItem { background-color: #ff6600; }
 TABLE.typo3-TCEforms TABLE.typo3-TCEforms-select-checkbox TR TD { border-bottom: 1px #999 dashed; padding: 1px 3px 1px 3px; }