Add class names indicating number of rows.

This commit is contained in:
Dianne Skoll
2021-12-14 10:53:01 -05:00
parent b391b2129e
commit 386f36c3ae

View File

@@ -419,6 +419,14 @@ sub output_calendar
# Last column # Last column
my $last_col = ($first_col + $Numdays - 1) % 7; my $last_col = ($first_col + $Numdays - 1) % 7;
# Figure out how many rows
my $number_of_rows = int(($first_col + $Numdays ) / 7 + 0.999);
# Add a row for small calendars if necessary
if ($first_col == 0 && $last_col == 6) {
$number_of_rows++;
}
# Start the table # Start the table
my $class; my $class;
if ($Options{nostyle}) { if ($Options{nostyle}) {
@@ -448,7 +456,7 @@ sub output_calendar
if ($Options{nostyle}) { if ($Options{nostyle}) {
print "<tr>\n"; print "<tr>\n";
} else { } else {
print "<tr class=\"rem-cal-row\">\n"; print "<tr class=\"rem-cal-row rem-cal-row-$number_of_rows-rows\">\n";
} }
if ($first_col > 0) { if ($first_col > 0) {
small_calendar($Prevmon, $Prevlen, $Options{backurl}, small_calendar($Prevmon, $Prevlen, $Options{backurl},
@@ -464,7 +472,7 @@ sub output_calendar
if ($Options{nostyle}) { if ($Options{nostyle}) {
$class = ' width="14%"'; $class = ' width="14%"';
} else { } else {
$class = ' class="rem-empty"'; $class = ' class="rem-empty rem-empty-$number_of_rows-rows"';
} }
while ($col < $first_col) { while ($col < $first_col) {
print("<td$class>&nbsp;</td>\n"); print("<td$class>&nbsp;</td>\n");
@@ -472,7 +480,7 @@ sub output_calendar
} }
for (my $day=1; $day<=$Numdays; $day++) { for (my $day=1; $day<=$Numdays; $day++) {
draw_day_cell($day); draw_day_cell($day, $number_of_rows);
$col++; $col++;
if ($col == 7) { if ($col == 7) {
$col = 0; $col = 0;
@@ -481,7 +489,7 @@ sub output_calendar
if ($Options{nostyle}) { if ($Options{nostyle}) {
print "<tr>\n"; print "<tr>\n";
} else { } else {
print "<tr class=\"rem-cal-row\">\n"; print "<tr class=\"rem-cal-row rem-cal-row-$number_of_rows-rows\">\n";
} }
} }
} }
@@ -512,7 +520,7 @@ sub output_calendar
if ($Options{nostyle}) { if ($Options{nostyle}) {
print "<tr>\n"; print "<tr>\n";
} else { } else {
print "<tr class=\"rem-cal-row\">\n"; print "<tr class=\"rem-cal-row rem-cal-row-$number_of_rows-rows\">\n";
} }
small_calendar($Prevmon, $Prevlen, $Options{backurl}, small_calendar($Prevmon, $Prevlen, $Options{backurl},
($Firstwkday - $Prevlen + 35) % 7); ($Firstwkday - $Prevlen + 35) % 7);
@@ -529,7 +537,7 @@ sub output_calendar
sub draw_day_cell sub draw_day_cell
{ {
my($day) = @_; my($day, $number_of_rows) = @_;
my $shade = $shades->[$day]; my $shade = $shades->[$day];
my $week = ''; my $week = '';
if (exists($weeks->{$day})) { if (exists($weeks->{$day})) {
@@ -539,7 +547,7 @@ sub draw_day_cell
if ($Options{nostyle}) { if ($Options{nostyle}) {
$class = $classes->[$day] || ''; $class = $classes->[$day] || '';
} else { } else {
$class = $classes->[$day] || "rem-cell"; $class = $classes->[$day] || "rem-cell rem-cell-$number_of_rows-rows";
} }
if ($shade) { if ($shade) {
$shade = " style=\"background: $shade;\""; $shade = " style=\"background: $shade;\"";