Line # Revision Author
1 8 ahitrov@rambler.ru <& '/contenido/components/select.msn', name => $name.'_hour', values => \@hours, check => $hour &>
2 <& '/contenido/components/select.msn', name => $name.'_minute', values => \@minutes, check => $minute &>
3 <& '/contenido/components/select.msn', name => $name.'_second', values => \@seconds, check => $second &>
4
5 <%args>
6 $prop
7 $name => undef
8 $check => undef
9 </%args>
10
11 <%init>
12 # Формируем данные для select'а...
13 my @hours = map { $_ => sprintf('%02d', $_) } (0 .. 23);
14 my @minutes = map { $_ => sprintf('%02d', $_) } (0 ..59);
15 my @seconds = map { $_ => sprintf('%02d', $_) } (0 ..59);
16
17 if ($prop->{allow_null}) {
18 unshift @hours, '', '';
19 unshift @minutes, '', '';
20 unshift @seconds, '', '';
21 }
22
23 my ($hour, $minute, $second);
24 if ($check) {
25 $check =~ /(\d{1,2}):(\d{1,2}):(\d{1,2})/;
26 ($hour, $minute, $second) = ($1 + 0, $2 + 0, $3 + 0);
27 } elsif(!$prop->{allow_null}) {
28 ($second,$minute,$hour) = (localtime)[0 .. 2];
29 }
30 </%init>