Subversion Repositories CoffeeCatalog

Rev

Rev 9 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9 Rev 10
Line 71... Line 71...
71
              $h->option ({ value=>$_ }, $_)
71
              $h->option ({ value=>$_ }, $_)
72
          } "", 1..5]);
72
          } "", 1..5]);
73
}
73
}
Line 74... Line 74...
74
 
74
 
-
 
75
sub select_source {
-
 
76
	my $selection = shift;
75
sub select_source {
77
	my $colName = "channel";
-
 
78
	my $table = "channels";
-
 
79
	my @optionList;
-
 
80
  my $dbh = WebDB::connect ();
-
 
81
	
-
 
82
	my $cathan = $dbh->prepare("select distinct $colName from $table order by $colName");
-
 
83
 
-
 
84
	$cathan->execute();
-
 
85
	while (my ($cat) = $cathan->fetchrow) {
-
 
86
    push @optionList, $cat;
Line 76... Line 87...
76
  my $value = shift // "";
87
	}
77
  
88
  
78
  return $h->select ({ name=>"source" },
89
  return $h->select ({ name=>"source" },
79
    [ map { $value eq $_ ?
90
    [ map { $selection eq $_ ?
80
              $h->option ({ value=>$_, selected=>[] }, $_) :
91
              $h->option ({ value=>$_, selected=>[] }, $_) :
81
              $h->option ({ value=>$_ }, $_)
92
              $h->option ({ value=>$_ }, $_)
Line 82... Line 93...
82
          } "", qw(Direct Fellow Retail SCG) ]);
93
          } "", @optionList ]);
83
}
94
}
84
 
95