continuing to add the tabs system.

This commit is contained in:
JT Smith 2003-02-24 06:36:12 +00:00
parent 1b5fbf8622
commit 1df3108086
5 changed files with 172 additions and 6 deletions

View file

@ -219,14 +219,14 @@ sub www_editPage {
tie %tabs, 'Tie::IxHash';
%tabs = (
properties=>{
name=>WebGUI::International::get(103)
label=>WebGUI::International::get(103)
},
style=>{
name=>WebGUI::International::get(105),
label=>WebGUI::International::get(105),
uiLevel=>5
},
privileges=>{
name=>WebGUI::International::get(107),
label=>WebGUI::International::get(107),
uiLevel=>6
}
);

View file

@ -84,7 +84,64 @@ sub www_editStyle {
tie %style, 'Tie::CPHash';
if ($session{form}{sid} eq "new") {
$style{body} = "^AdminBar;\n\n<body>\n\n^-;\n\n</body>";
$style{styleSheet} = "<style>\n\n</style>";
$style{styleSheet} = '
<style>
.content{
font-family: helvetica, arial;
font-size: 10pt;
}
.adminBar {
background-color: #dddddd;
font-family: helvetica, arial;
}
.tableMenu {
background-color: #dddddd;
font-size: 8pt;
font-family: Helvetica, Arial;
}
.tableMenu a {
text-decoration: none;
}
.tableHeader {
background-color: #dddddd;
font-size: 10pt;
font-family: Helvetica, Arial;
}
.tableData {
font-size: 10pt;
font-family: Helvetica, Arial;
}
.pollColor {
background-color: #cccccc;
border: thin solid #aaaaaa;
}
.pagination {
font-family: helvetica, arial;
font-size: 8pt;
text-align: center;
}
.tab {
border: 1px solid black;
background-color: #eeeeee;
}
.tabBody {
border: 1px solid black;
border-top: 1px solid black;
border-left: 1px solid black;
background-color: #dddddd;
}
div.tabs {
line-height: 15px;
font-size: 14px;
}
.tabHover {
background-color: #cccccc;
}
.tabActive {
background-color: #dddddd;
}
</style>
';
} else {
%style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}");
}

View file

@ -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>';