Line # Revision Author
1 3 ahitrov@rambler.ru <%args>
2 $prop => undef
3 $name => undef
4 $check => undef
5 </%args>
6
7 <%init>
8
9 my @localtime = localtime(); $localtime[4]++; $localtime[5] += 1900;
10
11 # ��������� ������ ��� select'�...
12 my @days = map { $_ => $_ } (1 .. 31);
13 my $months = $m->comp('/contenido/components/get_months.msn');
14 my @years = map { $_ => $_ } (1940 .. $localtime[5] + 5);
15
16 if ($prop->{allow_null}) {
17 unshift @days, '', '';
18 unshift @$months, '', '';
19 unshift @years, '', '';
20 }
21
22 # ������������ ������� ����...
23 my ($year,$month,$day);
24 if ($check) {
25 $check =~ /(\d{4})-(\d{1,2})-(\d{1,2})/;
26 ($year, $month, $day) = ($1+0, $2+0, $3+0);
27 } elsif(!$prop->{allow_null}) {
28 ($day,$month,$year) = @localtime[3 .. 5];
29 }
30 60 ahitrov@rambler.ru my $now = Contenido::DateTime->new;
31
32 3 ahitrov@rambler.ru </%init>
33
34 <& "/contenido/components/select.msn", name => $name.'_day', values => \@days, check => $day &><&
35 '/contenido/components/select.msn', name => $name.'_month', values => $months, check => $month &><&
36 '/contenido/components/select.msn', name => $name.'_year', values => \@years, check => $year &>
37 62 ahitrov@rambler.ru % if ( ref $prop && exists $prop->{attr} ) {
38 60 ahitrov@rambler.ru <span style="padding-left:20px;"><a href="javascript:void(0)" onclick="set_<% $prop->{attr} %>_now()" style="color:red;">������!</a></span>
39 <script type="text/javascript">
40 <!--
41 function set_<% $prop->{attr} %>_now () {
42 document.forms['form'].elements['<% $prop->{attr} %>_day'].value = '<% $now->day %>';
43 document.forms['form'].elements['<% $prop->{attr} %>_month'].value = '<% $now->mon %>';
44 document.forms['form'].elements['<% $prop->{attr} %>_year'].value = '<% $now->year %>';
45 }
46 //-->
47 </script>
48 62 ahitrov@rambler.ru % }