/[gnatsweb]/gnatsweb/gnatsweb.pl
ViewVC logotype

Diff of /gnatsweb/gnatsweb.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.77 by yngves, Sat Nov 3 11:41:44 2001 UTC revision 1.78 by yngves, Sat Nov 3 13:19:16 2001 UTC
# Line 1037  sub sendpr Line 1037  sub sendpr
1037        print popup_or_scrolling_menu($_, @values, $default),        print popup_or_scrolling_menu($_, @values, $default),
1038              "</td>\n</tr>\n";              "</td>\n</tr>\n";
1039      }      }
1040        elsif (fieldinfo ($_, 'fieldtype') eq 'multienum')
1041        {
1042          my $size = @{$values[0]} < 4 ? @{$values[0]} : 4;
1043          my $defaultsref = parse_multienum($fields{$_}, $_);
1044          
1045          print $q->scrolling_list(-name=>$_, -values=>@values, -size=>$size,
1046                                   -multiple=>'true', -default=>$default),
1047          "</td>\n</tr>\n";
1048        }
1049      elsif (fieldinfo($_, 'fieldtype') eq "multitext")      elsif (fieldinfo($_, 'fieldtype') eq "multitext")
1050      {      {
1051        my $rows = 4;        my $rows = 4;
# Line 1141  sub submitnewpr Line 1150  sub submitnewpr
1150      {      {
1151        $val = fix_multiline_val($val);        $val = fix_multiline_val($val);
1152      }      }
1153        elsif((fieldinfo ($key, 'fieldtype') || '') eq 'multienum')
1154        {
1155          my @val = $q->param($key);
1156          $val = unparse_multienum(\@val, $key);
1157        }
1158      $fields{$key} = $val;      $fields{$key} = $val;
1159    }    }
1160    
# Line 1495  sub edit Line 1509  sub edit
1509        print popup_or_scrolling_menu($_, @values, $fields{$_}),        print popup_or_scrolling_menu($_, @values, $fields{$_}),
1510              "</td>\n</tr>\n";              "</td>\n</tr>\n";
1511      }      }
1512        elsif (fieldinfo ($_, 'fieldtype') eq 'multienum')
1513        {
1514          my $size = @{$values[0]} < 4 ? @{$values[0]} : 4;
1515          my $defaultsref = parse_multienum($fields{$_}, $_);
1516          
1517          print $q->scrolling_list(-name=>$_, -values=>@values, -size=>$size,
1518                                   -multiple=>'true', -default=>$defaultsref),
1519          "</td>\n</tr>\n";
1520        }
1521      elsif (fieldinfo ($_, 'fieldtype') eq 'multitext')      elsif (fieldinfo ($_, 'fieldtype') eq 'multitext')
1522      {      {
1523        my $rows = 4;        my $rows = 4;
# Line 1613  sub submitedit Line 1636  sub submitedit
1636        {        {
1637          $val = fix_multiline_val($val);          $val = fix_multiline_val($val);
1638        }        }
1639          elsif($ftype eq 'multienum')
1640          {
1641            my @val = $q->param($key);
1642            $val = unparse_multienum(\@val, $key);
1643          }
1644        $fields{$key} = $val;        $fields{$key} = $val;
1645      }      }
1646    
# Line 1753  sub query_page Line 1781  sub query_page
1781    
1782    foreach (@fieldnames)    foreach (@fieldnames)
1783    {    {
1784      if (fieldinfo($_, 'fieldtype') eq 'enum')      if (fieldinfo($_, 'fieldtype') =~ 'enum')
1785      {      {
1786        print "<tr><td>$_:</td>\n<td>";        print "<tr><td>$_:</td>\n<td>";
1787        my $value_list=fieldinfo($_, 'values');        my $value_list=fieldinfo($_, 'values');
1788        my @values=('any', @$value_list);        my @values=('any', @$value_list);
1789        print popup_or_scrolling_menu ($_, \@values, $values[0]);        if (fieldinfo($_, 'fieldtype') eq 'enum')
1790          {
1791            print popup_or_scrolling_menu ($_, \@values, $values[0]);
1792          }
1793          elsif (fieldinfo($_, 'fieldtype') eq 'multienum')
1794          {
1795            my $size = @values < 4 ? @values : 4;
1796            print $q->scrolling_list(-name=>$_, -values=>\@values, -size=>$size,
1797                                     -multiple=>'true', -defaults=>$values[0]);
1798          }
1799        print "</td>\n</tr>\n";        print "</td>\n</tr>\n";
1800      }      }
1801    }    }
1802      
1803      print    print
1804          "<tr><td></td><td>",          "<tr><td></td><td>",
1805          $q->checkbox_group(-name=>'ignoreclosed',          $q->checkbox_group(-name=>'ignoreclosed',
1806                         -values=>['Ignore Closed'],                         -values=>['Ignore Closed'],
# Line 1928  sub advanced_query_page Line 1965  sub advanced_query_page
1965    
1966      # 3rd column is blank or scrolling multi-select list      # 3rd column is blank or scrolling multi-select list
1967      print "<td>";      print "<td>";
1968      if (fieldinfo($_, 'fieldtype') eq 'enum')      if (fieldinfo($_, 'fieldtype') =~ 'enum')
1969      {      {
1970        my $ary_ref = fieldinfo($_, 'values');        my $ary_ref = fieldinfo($_, 'values');
1971        my $size = scalar(@$ary_ref);        my $size = scalar(@$ary_ref);
# Line 3097  sub fix_multiline_val Line 3134  sub fix_multiline_val
3134    $val;    $val;
3135  }  }
3136    
3137    # unparse_multienum -
3138    #     Multienum field values arrive from the form as an array.  We
3139    #     need to put all values into one string, values separated by the
3140    #     multienum separator specified in the field config.
3141    sub unparse_multienum
3142    {
3143      my @values = @{$_[0]};
3144      my $field = $_[1];
3145      my $valstring;
3146      
3147      # Get the first character from the field separators string.
3148      my @response = client_cmd("ftypinfo $field separators");
3149      $response[0] =~ /'(.*)'/;
3150      my $separator = substr $1, 0, 1;
3151      
3152      # Prepare the string of separated values.
3153      foreach my $value (@values)
3154      {
3155        $valstring .= $value . $separator;
3156      }
3157      chop $valstring;  # Got one separator too many in previous loop.
3158      return $valstring;
3159    }
3160    
3161    # parse_multienum
3162    #     Passed a properly separated Multienum value string, we parse it
3163    #     by splitting on the multienum separator(s) specified in the
3164    #     field config and return the result as an array ref.
3165    sub parse_multienum
3166    {
3167      my $valstring = $_[0];
3168      my $field = $_[1];
3169      
3170      # Get the field separators string.
3171      my @response = client_cmd("ftypinfo $field separators");
3172      $response[0] =~ /'(.*)'/;
3173      my $separators = $1;
3174      
3175      # Split and return array ref.
3176      my @values = split /[$separators]/, $valstring;
3177      return \@values;
3178    }
3179    
3180  # parse_categories -  # parse_categories -
3181  #     Parse the categories file.  #     Parse the categories file.

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26