1 |
3 |
ahitrov@rambler.ru |
<& '/contenido/components/select.msn', name => $name.'_day', values => \@days, check => $day &> |
2 |
|
|
<& '/contenido/components/select.msn', name => $name.'_month', values => \@months, check => $month &> |
3 |
|
|
<& '/contenido/components/select.msn', name => $name.'_year', values => \@years, check => $year &> |
4 |
|
|
|
5 |
|
|
<& '/contenido/components/select.msn', name => $name.'_hour', values => \@hours, check => $hour &> |
6 |
|
|
<& '/contenido/components/select.msn', name => $name.'_minute', values => \@minutes, check => $minute &> |
7 |
60 |
ahitrov@rambler.ru |
% if ( $prop->{noseconds} ) { |
8 |
|
|
<input type="hidden" name="<% $prop->{attr} %>_second" value="0"> |
9 |
|
|
% } else { |
10 |
3 |
ahitrov@rambler.ru |
<& '/contenido/components/select.msn', name => $name.'_second', values => \@seconds, check => $second &> |
11 |
60 |
ahitrov@rambler.ru |
% } |
12 |
62 |
ahitrov@rambler.ru |
% if ( ref $prop && exists $prop->{attr} ) { |
13 |
60 |
ahitrov@rambler.ru |
<span style="padding-left:20px;"><a href="javascript:void(0)" onclick="set_<% $prop->{attr} %>_now()" style="color:red;">������!</a></span> |
14 |
|
|
<script type="text/javascript"> |
15 |
|
|
<!-- |
16 |
|
|
function set_<% $prop->{attr} %>_now () { |
17 |
|
|
document.forms['form'].elements['<% $prop->{attr} %>_day'].value = '<% $now->day %>'; |
18 |
|
|
document.forms['form'].elements['<% $prop->{attr} %>_month'].value = '<% $now->mon %>'; |
19 |
|
|
document.forms['form'].elements['<% $prop->{attr} %>_year'].value = '<% $now->year %>'; |
20 |
|
|
document.forms['form'].elements['<% $prop->{attr} %>_hour'].value = '<% $now->hour %>'; |
21 |
|
|
document.forms['form'].elements['<% $prop->{attr} %>_minute'].value = '<% $now->minute %>'; |
22 |
62 |
ahitrov@rambler.ru |
% unless ( $prop->{noseconds} ) { |
23 |
60 |
ahitrov@rambler.ru |
document.forms['form'].elements['<% $prop->{attr} %>_second'].value = '<% $now->second %>'; |
24 |
62 |
ahitrov@rambler.ru |
% } |
25 |
60 |
ahitrov@rambler.ru |
} |
26 |
|
|
//--> |
27 |
|
|
</script> |
28 |
62 |
ahitrov@rambler.ru |
% } |
29 |
3 |
ahitrov@rambler.ru |
<%args> |
30 |
|
|
$prop |
31 |
|
|
$name => undef |
32 |
|
|
$check => undef |
33 |
|
|
</%args> |
34 |
|
|
|
35 |
|
|
<%init> |
36 |
|
|
|
37 |
|
|
my @localtime = localtime(); $localtime[4]++; $localtime[5] += 1900; |
38 |
|
|
|
39 |
|
|
# ��������� ������ ��� select'�... |
40 |
|
|
my @days = map { $_ => $_ } (1..31); |
41 |
|
|
my @months = @{ $m->comp('/contenido/components/get_months.msn') }; |
42 |
|
|
my @years = map { $_ => $_ } ( $localtime[5] - 5 .. $localtime[5] + 5); |
43 |
|
|
my @hours = map { $_ => sprintf('%02d', $_) } (0 .. 23); |
44 |
60 |
ahitrov@rambler.ru |
my @minutes = map { $_ => sprintf('%02d', $_) } (0 .. 59); |
45 |
|
|
my @seconds; |
46 |
|
|
if ( exists $prop->{seconds_step} && $prop->{seconds_step} > 1 ) { |
47 |
|
|
@seconds = grep { ($_ % $prop->{seconds_step}) == 0 } map { $_ => sprintf('%02d', $_) } (0 .. 59); |
48 |
|
|
} else { |
49 |
|
|
@seconds = map { $_ => sprintf('%02d', $_) } (0 .. 59); |
50 |
|
|
} |
51 |
3 |
ahitrov@rambler.ru |
|
52 |
|
|
if ($prop->{allow_null}) { |
53 |
|
|
unshift @days, '', ''; |
54 |
|
|
unshift @months, '', ''; |
55 |
|
|
unshift @years, '', ''; |
56 |
|
|
unshift @hours, '', ''; |
57 |
|
|
unshift @minutes, '', ''; |
58 |
|
|
unshift @seconds, '', ''; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
my ($year,$month,$day,$hour,$minute, $second); |
62 |
|
|
if ($check) { |
63 |
|
|
$check =~ /(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2}):(\d{1,2})/; |
64 |
|
|
($year, $month, $day, $hour, $minute, $second) = ($1 + 0, $2 + 0, $3 + 0, $4 + 0, $5 + 0, $6 + 0); |
65 |
|
|
} elsif(!$prop->{allow_null}) { |
66 |
|
|
($second,$minute,$hour,$day,$month,$year) = @localtime[0 .. 5]; |
67 |
|
|
} |
68 |
60 |
ahitrov@rambler.ru |
my $now = Contenido::DateTime->new; |
69 |
|
|
|
70 |
3 |
ahitrov@rambler.ru |
</%init> |