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