Browse Source

add more labling for options pages

Thijs Kinkhorst 16 years ago
parent
commit
e6f959fbd1
2 changed files with 9 additions and 8 deletions
  1. 5 0
      functions/forms.php
  2. 4 8
      templates/default/options.tpl

+ 5 - 0
functions/forms.php

@@ -190,6 +190,7 @@ function addSelect($sName, $aValues, $default = null, $bUsekeys = false, $aAttri
              . htmlspecialchars($v);
     }
 
+    if (! isset($aAttribs['id'])) $aAttribs['id'] = $sName;
 
     // make sure $default is an array, since multiple select lists
     // need the chance to have more than one default... 
@@ -292,6 +293,10 @@ function addTextArea($sName, $sText = '', $iCols = 40, $iRows = 10, $aAttribs =
 
     // add default css
     else if (!isset($aAttribs['class'])) $aAttribs['class'] = 'sqmtextarea';
+    
+    if ( empty( $aAttribs['id'] ) ) {
+        $aAttribs['id'] = strtr($sName,'[]','__');
+    }
 
     global $oTemplate;
 

+ 4 - 8
templates/default/options.tpl

@@ -61,15 +61,11 @@ foreach ($option_groups as $option) {
             echo   "<tr>\n" .
                    " <td class=\"optionName\"" . ($opt->caption_wrap ? '' : ' style="white-space:nowrap"') . ">\n  ";
 
-            if ($opt->type == SMOPT_TYPE_BOOLEAN_CHECKBOX
-             || $opt->type == SMOPT_TYPE_BOOLEAN) {
-                echo '<label for="new_' . $opt->name . '">'
-                   . $opt->caption . '</label>';
-            } else if ($opt->type == SMOPT_TYPE_TEXTAREA && !empty($opt->trailing_text)) {
-                echo $opt->caption . '<br /><small>' . $opt->trailing_text . '</small>';
-            } else {
-                echo $opt->caption;
+            echo '<label for="new_' . $opt->name . '">' . $opt->caption;
+            if ($opt->type == SMOPT_TYPE_TEXTAREA && !empty($opt->trailing_text)) {
+                echo '<br /><small>' . $opt->trailing_text . '</small>';
             }
+            echo '</label>';
 
             echo   "\n </td>\n" .
                    " <td class=\"optionValue\">\n" .