Required custom select fields will no longer show the empty option. This is only...
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 13 Jan 2009 17:26:09 +0000 (12:26 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 13 Jan 2009 17:26:09 +0000 (12:26 -0500)
* docs/changes.txt: Merged
* includes/functions.php:
(construct_custom_fields): Required select fields do not get a blank option
* templates/bugfield_select_single.tpl: Need to convert to BSTemplate
* templates/bugfield_select_single_option.tpl: ditto

Cherry-pick 88054e0ab0837f09cfc740369d6469e9816a3d6c

docs/changes.txt
includes/functions.php
templates/bugfield_select_single.tpl
templates/bugfield_select_single_option.tpl

index 22ae6abbc039d4b93dbd9d80c33b2a469df0fda2..977beb5e91b4b1498a70ef441be8b3070fbb13d6 100644 (file)
@@ -4,7 +4,10 @@
 
 1.2.3
 ===============================
-- Fixed: Custom select field that is mandatory doesn't accept the first option as a valid entry (bug://report/121)
+- Fixed: #121: Custom select field that is mandatory doesn't accept the first option as a valid entry
+- Fixed: Improved XHTML compliance in various templates
+- Fixed: #134: Column headers (defined in includes/definitions.php) were not marked with T() for translation
+- Change: Required custom select fields will no longer show the empty option (these fields could not be saved as empty, though, because they wouldn't validate -- this is purely an interface change)
 
 1.2.2
 ===============================
index 397126134061654cd868ccf54a42e55bd4248abe..38cdf84a8d2ed073c2f10b9e78d44f4edd564227 100755 (executable)
@@ -290,14 +290,21 @@ function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefau
                                case 'select_single':
                                        $selects = unserialize($field['selects']);
                                        $value = trim($value);
+                                       $options = '';
                                        
-                                       $tpl = new BSTemplate('bugfield_select_single_option');
-                                       $tpl->vars = array(
-                                               'id'            => -1,
-                                               'select'        => '',
-                                               'selected'      => ((!$field['usedefault'] && !trim($value)) ? ' selected="selected"' : '')
-                                       );
-                                       $options = $tpl->evaluate()->getTemplate();
+                                       // this overrides $field['usedefault'] because required fields will no longer have
+                                       // blank values as options
+                                       // TODO document above comment in the ACP
+                                       if (!$field['required'])
+                                       {
+                                               $tpl = new BSTemplate('bugfield_select_single_option');
+                                               $tpl->vars = array(
+                                                       'id'            => -1,
+                                                       'select'        => '',
+                                                       'selected'      => ((!$field['usedefault'] && !trim($value)) ? ' selected="selected"' : '')
+                                               );
+                                               $options = $tpl->evaluate()->getTemplate();
+                                       }
                                        
                                        foreach ($selects as $id => $select)
                                        {
index bf3048f00b001fdf2d21d155e35d78d590ce6122..1b0a8c85ae6430b2599ec8a97f57591226634f44 100644 (file)
@@ -1,6 +1,6 @@
        <!-- custom field<%- $field['fieldid'] %> -->
        <fieldset>
-               <legend><%- $field['name'] %> <%- $help['field' . $field['fieldid']] %></legend>
+               <legend><%- $field['name'] %> help[field<%- $field['fieldid'] %>]</legend>
                <div class="field"><select name="custom<%- $field['fieldid'] %>"><%- $options %></select></div>
        </fieldset>
        <!-- / custom field<%- $field['fieldid'] %> -->
\ No newline at end of file
index aaa959176ffd19704f12a5fc8025f78ed8848885..d4ab28309c8c495b9ffabcf493985cb4aa90adc5 100644 (file)
@@ -1 +1 @@
-<option value="$id"$selected>$select</option>
\ No newline at end of file
+<option value="<%- $id %>"<%- $selected %>><%- $select %></option>
\ No newline at end of file