[Bio] / RegSubMa / FilterSelect.pm Repository:
ViewVC logotype

View of /RegSubMa/FilterSelect.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (download) (as text) (annotate) (vendor branch)
Wed Apr 4 17:08:51 2007 UTC (13 years, 1 month ago) by mkubal
Branch: MAIN, fig
CVS Tags: v_1_0_0, HEAD
Changes since 1.1: +0 -0 lines
initial checkin

package FilterSelect;

use strict;
use warnings;

1;

sub new {
  my ($params) = @_;

  my $values = $params->{values} || return "no data passed to filter select";
  my $labels = $params->{labels} || $values;
  my $name   = $params->{name}   || "filter_select";
  my $id     = $params->{id}     || "filter_select";
  my $size   = $params->{size}   || 8;
  my $width  = $params->{width}  || 200;

  my $values_string = join("~", @$values);
  $values_string =~ s/'/\{/g;
  my $labels_string = join("~", @$labels);
  $labels_string =~ s/'/\{/g;

  my $select = "<input type='hidden' value='" . $values_string . "' id='filter_select_values_" . $id . "'>\n";
  $select .= "<input type='hidden' value='" . $labels_string . "' id='filter_select_labels_" . $id . "'>\n";
  $select .= "<input type='hidden' value='" . $values->[0] . "' id='filter_select_currval_" . $id . "' name='" . $name . "'>\n";
  $select .= "<input type='text' style='width: " . $width . "px;' name='" . $name . "_text' onkeyup='update_select(\"" . $id . "\");' id='filter_select_textbox_" . $id . "' value='Enter keyword to narrow search' onclick='empty_select(\"" . $id ."\");'><br/>\n";
  $select .= "<select style='width: " . $width . "px;' name='" . $name . "_select' id='filter_select_" .  $id. "' onchange='update_select_text(\"" . $id . "\");' size='" . $size . "'>";
  for (my $i=0; $i<scalar(@$values); $i++) {
    $select .= "<option value='" . $values->[$i] . "'>" . $labels->[$i] . "</option>\n";
  }
  $select .= "</select>";
  
  return $select;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3