blob: b9a71d3f9d4380ba29f3db8190a7ff4fbee63c9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<%doc>-------------------------------------------------------------------
monthMenu: Display a pulldown menu of months
Optional arguments:
$menu_name - Name of menu, defaults to 'month'
$current - Selected month value (1 to 12)
$format - Choice of month labels:
'full' (January, February, ...)
'short' (Jan, Feb, ...)
'numeric' (1, 2, ...)
Defaults to 'full'. The format only affects appearance; the menu
values are always numeric.
-------------------------------------------------------------------</%doc>
<select name="<% $menu_name %>">
<option value="-1">-
% foreach my $month (1..12) {
<option value="<% $month %>" <% $month==$current ? "selected" : "" %>>
% if ($format eq 'full') {
<% $month_names[$month-1] %>
% } elsif ($format eq 'short') {
<% substr($month_names[$month-1],0,3) %>
% } elsif ($format eq 'numeric') {
<% sprintf("%02d",$month) %>
% }
% }
</select>
<%init>
my @month_names = qw(January February March April May June July August September October November December);
</%init>
<%args>
$menu_name=>'month'
$current=>undef
$format=>'full'
</%args>
|