}) if ($useTable);
# Print out a display label if necessary
if ($disp && !$compact) {
$m->out(qq{
}) if ($useTable);
$m->out(qq{} . $lang->maketext($disp) . ': ');
$m->out(qq{
}) if ($useTable);
} else {
$m->out(qq{
}) if ($useTable);
}
if (!$useTable) {$compact = 1};
#-- Month Select
if ($mon) {
$mk_time_field->({'base' => $base_name.'_mon',
'default' => $s->{'mon'},
'label' => 'Month',
'vals' => \@month,
'width' => $cellWidth,
'compact' => $compact});
$cellsDisplayed++;
}
#-- Day Select
if ($day) {
$mk_time_field->({'base' => $base_name.'_day',
'default' => $s->{'day'},
'label' => 'Day',
'localize'=> 0,
'vals' => $day,
'width' => $cellWidth,
'compact' => $compact});
$cellsDisplayed++;
}
#-- Year Select
if ($year) {
$mk_time_field->({'base' => $base_name.'_year',
'default' => $s->{'year'},
'label' => 'Year',
'vals' => $year,
'localize'=> 0,
'width' => $cellWidth,
'compact' => $compact});
$cellsDisplayed++;
}
#-- Hour Select
if ($hour) {
$mk_time_field->({'base' => $base_name.'_hour',
'default' => $s->{'hour'},
'label' => 'Hour',
'localize'=> 0,
'vals' => $hour,
'width' => $cellWidth,
'compact' => $compact});
$cellsDisplayed++;
}
#-- Minute Select
if ($min) {
$mk_time_field->({'base' => $base_name.'_min',
'default' => $s->{'min'},
'label' => 'Minute',
'localize' => 0,
'vals' => $min,
'width' => $cellWidth,
'compact' => $compact});
$cellsDisplayed++;
}
# End the table unless this is a compact listing.
unless ($compact) {
# make a cell to use the remaining space, so Netscape can do the right thing
$m->out("
");
$m->out(q{
});
}
%perl>
<%args>
$widget
$base_name
$default_current
$year => ''
$mon => ''
$day => ''
$hour => ''
$min => ''
$formName => "forms[0]"
$indent => undef
$useTable => 0
$compact => undef
$disp => ''
%args>
<%init>
# Keep this time widget with this base name distict from others on the page.
my $sub_widget = "$widget.$base_name";
my $s = get_state_data($sub_widget);
my $js;
my $agent = detect_agent();
my $cw = 80;
my $cellWidth = "width=$cw";
my $cellsDisplayed = 0;
if ($compact) { $useTable = 0 };
$indent = $useTable ? FIELD_INDENT + 3 : 0 unless defined $indent;
$indent -= 7 if $agent->nav4;
# Set some default values for the time if necessary.
if ($default_current) {
$s->{year} ||= strfdate(undef, '%Y');
$s->{mon} ||= strfdate(undef, '%m');
$s->{day} ||= strfdate(undef, '%d');
$s->{hour} ||= strfdate(undef, '%H');
$s->{min} ||= strfdate(undef, '%M');
}
my @mon_names = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my @month = map { [$_,$lang->maketext($mon_names[$_-1])] } ('01'..'12');
if ($year && $mon && $day ) {
$js = ' onChange="';
$js .= "setDays('".$base_name."_year', '".$base_name."_mon', '".$base_name."_day', this)\"";
}
%init>
<%once>
my $mk_time_field = sub {
my ($p) = @_;
$p->{label} = $lang->maketext($p->{label});
$m->out('