-add tab-css to constructor

This commit is contained in:
Christian Kocourek 2003-12-19 17:35:29 +00:00
parent 223c4cec0a
commit 54cf63becb

View file

@ -124,7 +124,7 @@ sub hidden {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 new ( tabHashRef ) =head2 new ( tabHashRef , cssString)
Constructor. Constructor.
@ -148,16 +148,25 @@ A hash reference containing the definition of the tabs. It should be constructed
} }
); );
=item cssString
A string containing the link to the tab-CascadingStyleSheet
default = extrasPath.'/tabs/tabs.css'
=back =back
=cut =cut
sub new { sub new {
my ($class, $tabs) = @_; my ($class, $tabs, $css);
$class = $_[0];
$tabs = $_[1];
$css = $_[2] || $session{config}{extrasURL}.'/tabs/tabs.css';
foreach my $key (keys %{$tabs}) { foreach my $key (keys %{$tabs}) {
$tabs->{$key}{form} = WebGUI::HTMLForm->new; $tabs->{$key}{form} = WebGUI::HTMLForm->new;
} }
bless { _submit=>WebGUI::Form::submit(), _form=>WebGUI::Form::formHeader(), _hidden=>"", _tab=>$tabs }, $class; bless { _submit=>WebGUI::Form::submit(), _form=>WebGUI::Form::formHeader(), _hidden=>"", _tab=>$tabs, _css=>$css }, $class;
} }
@ -172,7 +181,7 @@ Returns an HTML string with all the necessary components to draw the tab form.
sub print { sub print {
my $output = ' my $output = '
<script src="'.$session{config}{extrasURL}.'/tabs/tabs.js" type="text/javascript"></script> <script src="'.$session{config}{extrasURL}.'/tabs/tabs.js" type="text/javascript"></script>
<link href="'.$session{config}{extrasURL}.'/tabs/tabs.css" rel="stylesheet" rev="stylesheet" type="text/css"> <link href="'.$_[0]->{_css}.'" rel="stylesheet" rev="stylesheet" type="text/css">
'; ';
$output .= $_[0]->{_form}; $output .= $_[0]->{_form};
$output .= $_[0]->{_hidden}; $output .= $_[0]->{_hidden};