Convert Image::Graph and Poll over to use FormBuilder.

This commit is contained in:
Colin Kuskie 2010-11-29 09:37:28 -08:00
parent 0983362204
commit 5d4405f43d
5 changed files with 158 additions and 185 deletions

View file

@ -331,85 +331,80 @@ documentation.
sub configurationForm {
my $self = shift;
my $tab = shift;
$self->SUPER::configurationForm($tab);
my $i18n = WebGUI::International->new($self->session, 'Image_Graph_Pie');
my $f = WebGUI::HTMLForm->new($self->session);
$f->trClass('Graph_Pie');
$f->float(
-name => 'pie_radius',
-value => $self->getRadius,
-label => $i18n->get('radius'),
-hoverHelp => $i18n->get('radius description'),
$tab->addField('float',
name => 'pie_radius',
value => $self->getRadius,
label => $i18n->get('radius'),
hoverHelp => $i18n->get('radius description'),
);
$f->float(
-name => 'pie_topHeight',
-value => $self->getTopHeight,
-label => $i18n->get('pie height'),
-hoverHelp => $i18n->get('pie height description'),
$tab->addField('float',
name => 'pie_topHeight',
value => $self->getTopHeight,
label => $i18n->get('pie height'),
hoverHelp => $i18n->get('pie height description'),
);
$f->float(
-name => 'pie_tiltAngle',
-value => $self->getTiltAngle,
-label => $i18n->get('tilt angle'),
-hoverHelp => $i18n->get('tilt angle description'),
$tab->addField('float',
name => 'pie_tiltAngle',
value => $self->getTiltAngle,
label => $i18n->get('tilt angle'),
hoverHelp => $i18n->get('tilt angle description'),
);
$f->float(
-name => 'pie_startAngle',
-value => $self->getStartAngle,
-label => $i18n->get('start angle'),
-hoverHelp => $i18n->get('start angle description'),
$tab->addField('float',
name => 'pie_startAngle',
value => $self->getStartAngle,
label => $i18n->get('start angle'),
hoverHelp => $i18n->get('start angle description'),
);
$f->selectBox(
-name => 'pie_pieMode',
-value => [ $self->getPieMode ],
-label => $i18n->get('pie mode'),
-hoverHelp => $i18n->get('pie mode description'),
-options => {
$tab->addField('selectBox',
name => 'pie_pieMode',
value => [ $self->getPieMode ],
label => $i18n->get('pie mode'),
hoverHelp => $i18n->get('pie mode description'),
options => {
normal => $i18n->get('normal'),
stepped => $i18n->get('stepped'),
},
);
$f->yesNo(
-name => 'pie_shadedSides',
-value => $self->hasShadedSides,
-label => $i18n->get('shade sides'),
-hoverHelp => $i18n->get('shade sides description'),
$tab->addField('yesNo',
name => 'pie_shadedSides',
value => $self->hasShadedSides,
label => $i18n->get('shade sides'),
hoverHelp => $i18n->get('shade sides description'),
);
$f->float(
-name => 'pie_stickLength',
-value => $self->getStickLength,
-label => $i18n->get('stick length'),
-hoverHelp => $i18n->get('stick length description'),
$tab->addField('float',
name => 'pie_stickLength',
value => $self->getStickLength,
label => $i18n->get('stick length'),
hoverHelp => $i18n->get('stick length description'),
);
$f->float(
-name => 'pie_stickOffset',
-value => $self->getStickOffset,
-label => $i18n->get('stick offset'),
-hoverHelp => $i18n->get('stick offset description'),
$tab->addField('float',
name => 'pie_stickOffset',
value => $self->getStickOffset,
label => $i18n->get('stick offset'),
hoverHelp => $i18n->get('stick offset description'),
);
$f->color(
-name => 'pie_stickColor',
-value => $self->getStickColor,
-label => $i18n->get('stick color'),
-hoverHelp => $i18n->get('stick color description'),
$tab->addField('color',
name => 'pie_stickColor',
value => $self->getStickColor,
label => $i18n->get('stick color'),
hoverHelp => $i18n->get('stick color description'),
);
$f->selectBox(
-name => 'pie_labelPosition',
-value => [ $self->getLabelPosition ],
-label => $i18n->get('label position'),
-hoverHelp => $i18n->get('label position description'),
-options=> {
$tab->addField('selectBox',
name => 'pie_labelPosition',
value => [ $self->getLabelPosition ],
label => $i18n->get('label position'),
hoverHelp => $i18n->get('label position description'),
options=> {
center => $i18n->get('center'),
top => $i18n->get('top'),
bottom => $i18n->get('bottom'),
},
);
my $configForms = $self->SUPER::configurationForm;
$configForms->{'graph_pie'} = $f->printRowsOnly;
return $configForms;
}
#-------------------------------------------------------------------

View file

@ -41,58 +41,56 @@ documentation.
=cut
sub configurationForm {
my ($configForms, $f);
my $self = shift;
my $tab = shift;
my $i18n = WebGUI::International->new($self->session, 'Image_Graph_XYGraph');
$configForms = $self->SUPER::configurationForm;
$self->SUPER::configurationForm($tab);
$f = WebGUI::HTMLForm->new($self->session);
$f->trClass('Graph_XYGraph');
$f->integer(
$tab->addField('integer',
name => 'xyGraph_chartWidth',
value => $self->getChartWidth,
label => $i18n->get('chart width'),
hoverHelp => $i18n->get('chart width description'),
);
$f->integer(
$tab->addField('integer',
name => 'xyGraph_chartHeight',
value => $self->getChartHeight,
label => $i18n->get('chart height'),
hoverHelp => $i18n->get('chart height description'),
);
$f->yesNo(
$tab->addField('yesNo',
name => 'xyGraph_drawLabels',
value => $self->showLabels,
label => $i18n->get('draw labels'),
hoverHelp => $i18n->get('draw labels description'),
);
$f->yesNo(
$tab->addField('yesNo',
name => 'xyGraph_drawAxis',
value => $self->showAxis,
label => $i18n->get('draw axis'),
hoverHelp => $i18n->get('draw axis description'),
);
$f->color(
$tab->addField('color',
name => 'xyGraph_axisColor',
value => $self->getAxisColor,
label => $i18n->get('axis color'),
hoverHelp => $i18n->get('axis color description'),
);
$f->yesNo(
$tab->addField('yesNo',
name => 'xyGraph_drawRulers',
value => $self->showRulers,
label => $i18n->get('draw rulers'),
hoverHelp => $i18n->get('draw rulers description'),
);
$f->color(
$tab->addField('color',
name => 'xyGraph_rulerColor',
value => $self->getRulerColor,
label => $i18n->get('ruler color'),
hoverHelp => $i18n->get('ruler color description'),
);
$f->selectBox(
$tab->addField('selectBox',
name => 'xyGraph_drawMode',
value => [ $self->getDrawMode ],
label => $i18n->get('draw mode'),
@ -103,15 +101,12 @@ sub configurationForm {
stacked => 'Stacked (cumulative',
},
);
$f->float(
$tab->addField('float',
name => 'xyGraph_yGranularity',
value => $self->getYGranularity,
label => $i18n->get('y granularity'),
hoverHelp => $i18n->get('y granularity description'),
);
$configForms->{'graph_xygraph'} = $f->printRowsOnly;
return $configForms;
}
#-------------------------------------------------------------------

View file

@ -47,28 +47,23 @@ more information.
sub configurationForm {
my $self = shift;
my $tab = shift;
my $i18n = WebGUI::International->new($self->session, 'Image_Graph_XYGraph_Bar');
my $configForms = $self->SUPER::configurationForm;
my $f = WebGUI::HTMLForm->new($self->session);
$f->trClass('Graph_XYGraph_Bar');
$f->float(
$self->SUPER::configurationForm($tab);
$tab->addField('float',
name => 'xyGraph_bar_barSpacing',
value => $self->getBarSpacing,
label => $i18n->get('bar spacing'),
hoverHelp => $i18n->get('bar spacing description'),
);
$f->float(
$tab->addField('float',
name => 'xyGraph_bar_groupSpacing',
value => $self->getGroupSpacing,
label => $i18n->get('group spacing'),
hoverHelp => $i18n->get('group spacing description'),
);
$configForms->{'graph_xygraph_bar'} = $f->printRowsOnly;
return $configForms;
}
#-------------------------------------------------------------------