home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Web / Select.pm < prev    next >
Encoding:
Perl POD Document  |  2006-07-24  |  877 b   |  49 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Web::Select;
  6. use strict;
  7. use base qw(Debconf::Element::Select);
  8.  
  9.  
  10. sub show {
  11.     my $this=shift;
  12.  
  13.     $_=$this->question->extended_description;
  14.     s/\n/\n<br>\n/g;
  15.     $_.="\n<p>\n";
  16.  
  17.     my $default=$this->translate_default;
  18.     my $id=$this->id;
  19.     $_.="<b>".$this->question->description."</b>\n<select name=\"$id\">\n";
  20.     my $c=0;
  21.     foreach my $x ($this->question->choices_split) {
  22.         if ($x ne $default) {
  23.             $_.="<option value=".$c++.">$x\n";
  24.         }
  25.         else {
  26.             $_.="<option value=".$c++." selected>$x\n";
  27.         }
  28.     }
  29.     $_.="</select>\n";
  30.     
  31.     return $_;
  32. }
  33.  
  34.  
  35. sub value {
  36.     my $this=shift;
  37.  
  38.     return $this->SUPER::value() unless @_;
  39.     my $value=shift;
  40.  
  41.     $this->question->template->i18n('');
  42.     my @choices=$this->question->choices_split;
  43.     $this->question->template->i18n(1);
  44.     $this->SUPER::value($choices[$value]);
  45. }
  46.  
  47.  
  48. 1
  49.