package HTML::CalendarMonth;
-BEGIN {
- $HTML::CalendarMonth::VERSION = '1.25';
+{
+ $HTML::CalendarMonth::VERSION = '2.04';
}
use strict;
use warnings;
use Carp;
-BEGIN { $HTML::CalendarMonth::VERSION = 1.25 }
-
use HTML::ElementTable 1.18;
use HTML::CalendarMonth::Locale;
use HTML::CalendarMonth::DateTool;
_ctoih => {},
_caltool => undef,
_weeknums => undef,
- _today => undef,
dow1st => undef,
lastday => undef,
$self->item($self->year)->replace_content($self->item_alias($self->year));
if ($self->_head_my) {
- if ($self->head_m) {
- $self->item($self->month)->attr('colspan',$width - $self->year_span);
+ if ($self->head_m && $self->head_y) {
+ $self->item($self->year) ->attr('colspan', $self->year_span);
+ $self->item($self->month)->attr('colspan', $width - $self->year_span);
}
- else {
+ elsif ($self->head_y) {
$self->item($self->month)->mask(1);
$self->item($self->year)->attr('colspan', $width);
}
- if ($self->head_y) {
- $self->item($self->year)->attr('colspan',$self->year_span);
- }
- else {
+ elsif ($self->head_m) {
$self->item($self->year)->mask(1);
$self->item($self->month)->attr('colspan', $width);
}
# css classes
if ($self->enable_css) {
- $self ->push_attr(class => 'hcm-table' );
- $self->item_row($self->dayheaders)->push_attr(class => 'hcm-day-head' );
- $self->item ($self->year) ->push_attr(class => 'hcm-year-head' );
- $self->item ($self->month) ->push_attr(class => 'hcm-month-head');
- $self->item ($self->week_nums) ->push_attr(class => 'hcm-week-head' )
+ $self->push_attr(class => 'hcm-table');
+ $self->item_row($self->dayheaders)->push_attr(class => 'hcm-day-head')
+ if $self->head_dow;
+ $self->item($self->year)->push_attr(class => 'hcm-year-head')
+ if $self->head_y;
+ $self->item($self->month)->push_attr(class => 'hcm-month-head')
+ if $self->head_m;
+ $self->item($self->week_nums) ->push_attr(class => 'hcm-week-head')
if $self->head_week;
}
sub past_days {
my $self = shift;
- my $today = $self->_today;
+ my $today = $self->today;
if ($today < 0) {
return $self->days;
}
sub future_days {
my $self = shift;
- my $today = $self->_today;
+ my $today = $self->today;
if ($today < 0) {
return;
}
my $dom_now = defined $attrs{today} ? $dt->_dom_now(delete $attrs{today})
: $dt->_dom_now;
- $self->_today($dom_now);
- $self->today($dom_now) if $dom_now > 0;
+ $self->today($dom_now);
my $alias = $attrs{alias} || {};
if ($self->full_days < 0) {
my $c2 = HTML::CalendarMonth->new(
month => 8,
year => 2010,
- locale => 'zu_ZA'
+ locale => 'zu-ZA'
);
print $c2->as_HTML;
- # Full locale support via DateTime::Locale
- $c3 = HTML::CalendarMonth->new( month => 8, year => 79, locale => 'fr' );
- print $c3->as_HTML
-
# HTML-Tree integration
my $tree = HTML::TreeBuilder->parse_file('cal.html');
$tree->find_by_attribute(class => 'hcm-calendar')->replace_with($c);
Specifies whether to display days of the week header. Default 1.
+=item head_week
+
+Specifies whether to display the week-of-year numbering. Default 0.
+
=item locale
Specifies the id of the locale in which to render the calendar. Default
-is 'en_US'. By default, this will also control determine which day is
+is 'en-US'. By default, this will also control determine which day is
considered to be the first day of the week. See
L<HTML::CalendarMonth::Locale> for more information. If for some reason
you prefer to use different labels than those provided by C<locale>, see
-the C<alias> attribute below.
+the C<alias> attribute below. NOTE: DateTime::Locale versions 0.92 and
+earlier use underscores rather than dashes, e.g. 'en_US'.
=item full_days
the locale string, but when the calendar is rendered the aliased value
will appear.
-=item head_week
-
-Specifies whether to display the week-of-year numbering. Default 0.
-
=item week_begin
Specify first day of the week, which can be 1..7, starting with Sunday.
Set some handy CSS class attributes on elements, enabled by default.
Currently the classes are:
- hcm-table Set on the <lt>table<gt> tag of the calendar
- hcm-day-head Set on the day-of-week <lt>tr<gt> or <lt>td<gt> tags
- hcm-year-head Set on the <lt>td<gt> tag for the year
- hcm-month-head Set on the <lt>td<gt> tag for the month
- hcm-week-head Set on the <lt>td<gt> tags for the week-of-year
+ hcm-table Set on the E<lt>tableE<gt> tag of the calendar
+ hcm-day-head Set on the day-of-week E<lt>trE<gt> or E<lt>tdE<gt> tags
+ hcm-year-head Set on the E<lt>tdE<gt> tag for the year
+ hcm-month-head Set on the E<lt>tdE<gt> tag for the month
+ hcm-week-head Set on the E<lt>tdE<gt> tags for the week-of-year
=item semantic_css
(default) or from the 'today' parameter as provided to new(). Currently
these classes are:
- hcm-today Set on the <lt>td<gt> tag for today, if present
- hcm-past Set on the <lt>td<gt> tags for prior days, if present
- hcm-future Set on the <lt>td<gt> tags for subsequent days, if present
+ hcm-today Set on the E<lt>tdE<gt> tag for today, if present
+ hcm-past Set on the E<lt>tdE<gt> tags for prior days, if present
+ hcm-future Set on the E<lt>tdE<gt> tags for subsequent days, if present
=item today
=head1 COPYRIGHT
-Copyright (c) 1998-2010 Matthew P. Sisk. All rights reserved. All wrongs
+Copyright (c) 1998-2015 Matthew P. Sisk. All rights reserved. All wrongs
revenged. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.