1054 |
# Get default value(s). |
# Get default value(s). |
1055 |
my $default = fieldinfo($_, 'default'); |
my $default = fieldinfo($_, 'default'); |
1056 |
|
|
1057 |
my @values = fieldinfo($_, 'values'); |
my $values = fieldinfo($_, 'values'); |
1058 |
|
|
1059 |
# The "intro" provides a way for the site callback to print something |
# The "intro" provides a way for the site callback to print something |
1060 |
# at the top of a given field. |
# at the top of a given field. |
1066 |
|
|
1067 |
if (fieldinfo($_, 'fieldtype') eq "enum") |
if (fieldinfo($_, 'fieldtype') eq "enum") |
1068 |
{ |
{ |
1069 |
print popup_or_scrolling_menu($_, @values, $default), |
# Force user to choose a category. |
1070 |
|
if ($_ eq $CATEGORY_FIELD) |
1071 |
|
{ |
1072 |
|
push(@$values, "unknown") if (!grep /^unknown$/, @$values); |
1073 |
|
$default = "unknown"; |
1074 |
|
} |
1075 |
|
print popup_or_scrolling_menu($_, $values, $default), |
1076 |
"</td>\n</tr>\n"; |
"</td>\n</tr>\n"; |
1077 |
} |
} |
1078 |
elsif (fieldinfo ($_, 'fieldtype') eq 'multienum') |
elsif (fieldinfo ($_, 'fieldtype') eq 'multienum') |
1079 |
{ |
{ |
1080 |
my $defaultsref = parse_multienum($default, $_); |
my $defaultsref = parse_multienum($default, $_); |
1081 |
print multiselect_menu($_, @values, $defaultsref), |
print multiselect_menu($_, $values, $defaultsref), |
1082 |
"</td>\n</tr>\n"; |
"</td>\n</tr>\n"; |
1083 |
} |
} |
1084 |
elsif (fieldinfo($_, 'fieldtype') eq "multitext") |
elsif (fieldinfo($_, 'fieldtype') eq "multitext") |
1551 |
|
|
1552 |
$field_number++; |
$field_number++; |
1553 |
|
|
1554 |
my @values = fieldinfo ($_, 'values'); |
my $values = fieldinfo($_, 'values'); |
1555 |
|
|
1556 |
# The "intro" provides a way for the site callback to print something |
# The "intro" provides a way for the site callback to print something |
1557 |
# at the top of a given field. |
# at the top of a given field. |
1562 |
|
|
1563 |
if (fieldinfo ($_, 'fieldtype') eq 'enum') |
if (fieldinfo ($_, 'fieldtype') eq 'enum') |
1564 |
{ |
{ |
1565 |
print popup_or_scrolling_menu($_, @values, $fields{$_}), |
my $default = $fields{$_}; |
1566 |
|
# Check whether field value is a known enumeration value. |
1567 |
|
if (!(grep /^$default$/, @$values)) |
1568 |
|
{ |
1569 |
|
push(@$values, 'unknown') if (!grep /^unknown$/, @$values); |
1570 |
|
$default = 'unknown'; |
1571 |
|
} |
1572 |
|
print popup_or_scrolling_menu($_, $values, $default), |
1573 |
"</td>\n</tr>\n"; |
"</td>\n</tr>\n"; |
1574 |
} |
} |
1575 |
elsif (fieldinfo ($_, 'fieldtype') eq 'multienum') |
elsif (fieldinfo ($_, 'fieldtype') eq 'multienum') |
1576 |
{ |
{ |
1577 |
my $defaultsref = parse_multienum($fields{$_}, $_); |
my $defaultsref = parse_multienum($fields{$_}, $_); |
1578 |
print multiselect_menu($_, @values, $defaultsref), |
print multiselect_menu($_, $values, $defaultsref), |
1579 |
"</td>\n</tr>\n"; |
"</td>\n</tr>\n"; |
1580 |
} |
} |
1581 |
elsif (fieldinfo ($_, 'fieldtype') eq 'multitext') |
elsif (fieldinfo ($_, 'fieldtype') eq 'multitext') |
1731 |
last LOCKED; |
last LOCKED; |
1732 |
} |
} |
1733 |
|
|
1734 |
if($db_prefs{'user'} eq "" || $fields{$RESPONSIBLE_FIELD} eq "") |
my (@errors) = (); |
1735 |
|
if ($fields{$RESPONSIBLE_FIELD} eq "unknown") |
1736 |
|
{ |
1737 |
|
push(@errors, "$RESPONSIBLE_FIELD is 'unknown'"); |
1738 |
|
} |
1739 |
|
if ($fields{$CATEGORY_FIELD} eq "unknown") |
1740 |
{ |
{ |
1741 |
# dtb this appears to make it impossible to edit a PR with a blank |
push(@errors, "$CATEGORY_FIELD is 'unknown'."); |
1742 |
# Responsible field. this might not be the right thing to do... |
} |
1743 |
error_page("Responsible party is '$fields{$RESPONSIBLE_FIELD}', user is '$db_prefs{'user'}'"); |
if($fields{$SUBMITTER_ID_FIELD} eq "unknown") |
1744 |
|
{ |
1745 |
|
push(@errors, "$SUBMITTER_ID_FIELD is 'unknown'."); |
1746 |
|
} |
1747 |
|
if (@errors) |
1748 |
|
{ |
1749 |
|
push(@errors, |
1750 |
|
"Go back to the edit form, correct the errors and submit again."); |
1751 |
|
error_page("The PR has not been submitted.", \@errors); |
1752 |
last LOCKED; |
last LOCKED; |
1753 |
} |
} |
1754 |
|
|
1881 |
-values=>['Originated by You'], |
-values=>['Originated by You'], |
1882 |
-defaults=>[]); |
-defaults=>[]); |
1883 |
} |
} |
1884 |
"</td>\n</tr>\n"; |
print "</td>\n</tr>\n"; |
1885 |
} |
} |
1886 |
} |
} |
1887 |
|
|
2452 |
if ($fieldtypes[$whichfield] eq 'enum') |
if ($fieldtypes[$whichfield] eq 'enum') |
2453 |
{ |
{ |
2454 |
my $enumvals = fieldinfo($columns[$whichfield], 'values'); |
my $enumvals = fieldinfo($columns[$whichfield], 'values'); |
2455 |
$fieldcontents = $$enumvals[$fieldcontents - 1] || 'invalid'; |
# A zero means that the string is absent from the enumeration type. |
2456 |
|
$fieldcontents = $fieldcontents ? $$enumvals[$fieldcontents - 1] : 'unknown'; |
2457 |
} |
} |
2458 |
$fieldcontents = $q->escapeHTML($fieldcontents); |
$fieldcontents = $q->escapeHTML($fieldcontents); |
2459 |
$fieldcontents = nonempty($fieldcontents); |
$fieldcontents = nonempty($fieldcontents); |