#!/usr/bin/perl # edit_time.cgi # Show a form for editing or creating a time range require './itsecur-lib.pl'; &can_use_error("times"); &ReadParse(); if ($in{'new'}) { &header($text{'time_title1'}, "", undef, undef, undef, undef, &apply_button()); $time = { 'hours' => '*', 'days' => '*' }; } else { &header($text{'time_title2'}, "", undef, undef, undef, undef, &apply_button()); @times = &list_times(); if (defined($in{'idx'})) { $time = $times[$in{'idx'}]; } else { ($time) = grep { $_->{'name'} eq $in{'name'} } @times; $in{'idx'} = $time->{'index'}; } } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'time_header'}
\n"; # Show range name print "\n"; printf "\n", $time->{'name'}; # Show hour range print "\n", $text{'time_to'}, $to; # Show days of week print "\n"; print "
$text{'time_name'}
$text{'time_hours'} \n"; printf " %s\n", $time->{'hours'} eq "*" ? "checked" : "", $text{'time_allday'}; printf "\n", $time->{'hours'} eq "*" ? "" : "checked"; ($from, $to) = $time->{'hours'} eq "*" ? ( ) : split(/\-/, $time->{'hours'}); printf "%s \n", $text{'time_from'}, $from; printf "%s
$text{'time_days'} \n"; printf " %s\n", $time->{'days'} eq "*" ? "checked" : "", $text{'time_allweek'}; printf " %s
\n", $time->{'days'} eq "*" ? "" : "checked", $text{'time_sel'}; %days = map { $_, 1 } split(/,/, $time->{'days'}); print "
\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; } print "
\n"; &can_edit_disable("times"); print "
\n"; &footer("list_times.cgi", $text{'times_return'});