4 =head2 new Webmin::Tabs([&tabs])
5 Displayed at the top of a page, to allow selection of various pages
9 my ($self, $tabs) = @_;
10 if (defined(&Webmin::Theme::Tabs::new)) {
11 return new Webmin::Theme::Tabs(@_[1..$#_]);
13 $self = { 'tabs' => [ ],
16 $self->set_tabs($tabs) if (defined($tabs));
20 =head2 add_tab(name, link)
24 my ($self, $name, $link) = @_;
25 push(@{$self->{'tabs'}}, [ $name, $link ]);
29 Returns the HTML for the top of the page
35 $rv .= "<table border=0 cellpadding=0 cellspacing=0 width=100% height=20><tr>";
36 $rv .= "<td valign=bottom>";
37 $rv .= "<table border=0 cellpadding=0 cellspacing=0 height=20><tr>";
39 my ($high, $low) = ("#cccccc", "#9999ff");
40 my ($lowlc, $lowrc) = ( "/images/lc1.gif", "/images/rc1.gif" );
41 my ($highlc, $highrc) = ( "/images/lc2.gif", "/images/rc2.gif" );
42 foreach my $t (@{$self->get_tabs()}) {
43 if ($i == $self->get_tab()) {
44 # This is the selected tab
45 $rv .= "<td valign=top bgcolor=$high>".
46 "<img src=$highlc alt=\"\"></td>";
47 if ($self->get_link()) {
49 $rv .= "<td bgcolor=$high> ".
50 "<a href=$t->[1]><b>$t->[0]</b></a> </td>";
54 $rv .= "<td bgcolor=$high> <b>$t->[0]</b> </td>";
56 $rv .= "<td valign=top bgcolor=$high>".
57 "<img src=$highrc alt=\"\"></td>\n";
61 $rv .= "<td valign=top bgcolor=$low>".
62 "<img src=$lowlc alt=\"\"></td>";
63 $rv .= "<td bgcolor=$low> ".
64 "<a href=$t->[1]><b>$t->[0]</b></a> </td>";
65 $rv .= "<td valign=top bgcolor=$low>".
66 "<img src=$lowrc alt=\"\"></td>\n";
69 if ($self->{'wrap'} && $i%$self->{'wrap'} == 0) {
74 $rv .= "</tr></table></td>\n";
75 $rv .= "</tr></table>\n";
76 $rv .= "<table border=1 cellpadding=10 cellspacing=0 width=100%><tr><td>\n";
81 Returns the HTML for the bottom of the page
86 my $rv = "</td></tr></table>\n";
90 =head2 set_tab(number|link)
91 Sets the tab that is currently highlighted
95 my ($self, $tab) = @_;
96 if ($tab =~ /^\d+$/) {
97 $self->{'tab'} = $tab;
100 for(my $i=0; $i<@{$self->{'tabs'}}; $i++) {
101 if ($self->{'tabs'}->[$i]->[1] eq $tab) {
111 return $self->{'tab'};
114 =head2 set_link(link)
115 If called with a non-zero parameter, even the highlighted tab will be a link
119 my ($self, $link) = @_;
120 $self->{'link'} = $link;
126 return $self->{'link'};
131 my ($self, $tabs) = @_;
132 $self->{'tabs'} = $tabs;
138 return $self->{'tabs'};