/[pxelator]/lib/PXElator/html.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/html.pm

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

revision 153 by dpavlin, Wed Aug 5 23:22:17 2009 UTC revision 172 by dpavlin, Thu Aug 6 22:27:34 2009 UTC
# Line 2  package html; Line 2  package html;
2    
3  sub table {  sub table {
4          my $cols = shift;          my $cols = shift;
5            my $th;
6    
7            if ( $cols < 0 ) {
8                    $cols = abs($cols);
9                    $th .= qq|<th>| . shift(@_) . qq|</td>| foreach ( 1 .. $cols );
10                    $th .= qq|</tr>\n<tr>|;
11            }
12    
13          my @td = map { "<td>$_</td>" } @_;          my @td = map { "<td>$_</td>" } @_;
14          my $html = qq{<table>\n<tr>};          my $html = qq{<table>\n<tr>$th};
15          foreach ( 0 .. $#td ) {          foreach ( 0 .. $#td ) {
16                          $html .= $td[$_];                          $html .= $td[$_];
17                          $html .= qq{</tr>\n<tr>} if $_ % $cols == 1;                          $html .= qq{</tr>\n<tr>} if ( $_ + 1 ) % $cols == 0;
18          }          }
19          $html .= qq{</tr>\n</table>};          $html .= qq{</tr>\n</table>};
20  }  }
# Line 29  sub tt { Line 37  sub tt {
37    
38  sub select {  sub select {
39          my $name = shift;          my $name = shift;
40          my $checked_option = shift;          my $selected_option = shift;
41          return join("\n"                  return join("\n"        
42                  , qq|<select type=select name=$name>|                  , qq|<select type=select name=$name>|
43                  , join("\n", map { my $checked = $_ eq $checked_option ? 'checked' : ''; qq|<option name=$_ $checked>$_</option>| } @_ )                  , join("\n", map { my $selected = $_ eq $selected_option ? 'selected' : ''; qq|<option name=$_ $selected>$_</option>| } @_ )
44                  , qq|</select>|                  , qq|</select>|
45                  , qq|</form>|                  , qq|</form>|
46          );          );

Legend:
Removed from v.153  
changed lines
  Added in v.172

  ViewVC Help
Powered by ViewVC 1.1.26