continuing to add the tabs system.
This commit is contained in:
parent
1b5fbf8622
commit
1df3108086
5 changed files with 172 additions and 6 deletions
|
|
@ -1,10 +1,72 @@
|
|||
package WebGUI::TabForm;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2003 Plain Black LLC.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Session;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::TabForm
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Package that makes creating tab-based forms simple through an object-oriented API.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::TabForm;
|
||||
use Tie::IxHash;
|
||||
my %tabs;
|
||||
tie %tabs, 'Tie::IxHash';
|
||||
%tabs = (
|
||||
cool=>{
|
||||
label=>"Cool Tab",
|
||||
uiLevel=>5
|
||||
},
|
||||
good=>{
|
||||
label=>"Good Tab",
|
||||
uiLevel=>8
|
||||
}
|
||||
);
|
||||
|
||||
$tabform = WebGUI::TabForm->new;
|
||||
|
||||
$tabform->hidden($name, $value);
|
||||
$tabform->submit(\%params);
|
||||
|
||||
$html = $tabform->print;
|
||||
|
||||
$HTMLFormObject = $tabform->getTab($tabname);
|
||||
$HTMLFormObject->textarea( -name=>$name, -value=>$value, -label=>$label);
|
||||
|
||||
The best and easiest way to use this package is to just call the methods on the tabs directly.
|
||||
|
||||
$tabform->get($tabname)->textarea( -name=>$name, -value=>$value, -label=>$label);
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub getTab {
|
||||
return $_[0]->{_tab}{$_[1]}{form};
|
||||
}
|
||||
|
|
@ -17,7 +79,6 @@ sub new {
|
|||
my ($class, $tabs) = @_;
|
||||
my $form = WebGUI::HTMLForm->new(1);
|
||||
foreach my $key (keys %{$tabs}) {
|
||||
$tabs->{$key}{uiLevel} = 9 unless ($tabs->{$key}{uiLevel});
|
||||
$tabs->{$key}{form} = WebGUI::HTMLForm->new;
|
||||
}
|
||||
bless {_submit=>WebGUI::Form::submit(),_form=>$form,_tab=>$tabs}, $class;
|
||||
|
|
@ -42,7 +103,7 @@ sub print {
|
|||
if ($i == 1) {
|
||||
$tabs .= ' tabActive';
|
||||
}
|
||||
$tabs .= '">'.$_[0]->{_tab}{$key}{name}.'</span> ';
|
||||
$tabs .= '">'.$_[0]->{_tab}{$key}{label}.'</span> ';
|
||||
$form .= '<div id="content'.$i.'" class="tabBody"><table>';
|
||||
$form .= $_[0]->{_tab}{$key}{form}->printRowsOnly;
|
||||
$form .= '</table></div>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue