diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-05-31 12:42:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-05-31 12:42:02 +0000 |
commit | 39f6a9e79a72ff17907ffaddeadf1193ca5f1f8f (patch) | |
tree | 6a9fb6eb955dc8f9e84bc2b049bd7390591350b6 | |
parent | b7a0a744c6e3e51eed314d25b33e66000a8f56be (diff) | |
download | brdo-39f6a9e79a72ff17907ffaddeadf1193ca5f1f8f.tar.gz brdo-39f6a9e79a72ff17907ffaddeadf1193ca5f1f8f.tar.bz2 |
- CSS improvements to the calendar of the archive module. Updated the Xtemplate
theme and theme Marvin to take advantage of this. Patch by Al. Pretty stuff.
-rw-r--r-- | misc/drupal.css | 7 | ||||
-rw-r--r-- | modules/archive.module | 37 | ||||
-rw-r--r-- | modules/archive/archive.module | 37 | ||||
-rw-r--r-- | themes/marvin/marvin.css | 5 | ||||
-rw-r--r-- | themes/xtemplate/xtemplate.css | 8 |
5 files changed, 60 insertions, 34 deletions
diff --git a/misc/drupal.css b/misc/drupal.css index f7683929a..2e5eecb4b 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -13,6 +13,13 @@ .poll .links { text-align: center; } .poll .total { text-align: center; } +.calendar a { text-decoration: none; } +.calendar a:hover { text-decoration: none; } +.calendar table { border-collapse: collapse; } +.calendar td { text-align: center; border: 1px solid #000; padding: 1px; margin: 0; font-size: 0.8em; } +.calendar .row-week td a { display: block; } +.calendar .row-week td a:hover { background-color: #888; color: #fff; } + .form-item .title { font-weight: bold; margin-top: 1.1em; margin-bottom: 1px; } .form-item .description { font-size: 0.85em; } diff --git a/modules/archive.module b/modules/archive.module index 3bb06ebae..51ca1db35 100644 --- a/modules/archive.module +++ b/modules/archive.module @@ -10,7 +10,8 @@ function archive_system($field){ function archive_calendar($original = 0) { // Extract today's date: - $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); + $start_of_today = mktime(0, 0, 0, date("n", time()), date("d", time()), date("Y", time())); + $end_of_today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); // Extract the requested date: if (arg(0) == "archive" && arg(3)) { @@ -18,14 +19,14 @@ function archive_calendar($original = 0) { $month = arg(2); $day = arg(3); - $requested = mktime(23, 59, 59, $month, $day, $year); + $requested = mktime(0, 0, 0, $month, $day, $year); } else { $year = date("Y", time()); $month = date("n", time()); $day = date("d", time()); - $requested = $today; + $requested = $end_of_today; } // Extract first day of the month: @@ -42,8 +43,9 @@ function archive_calendar($original = 0) { // Generate calendar header: $output .= "\n<!-- calendar -->\n"; - $output .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n"; - $output .= " <tr><td align=\"center\" colspan=\"7\"><small>". l("<", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l(">", "archive/". date("Y/m/d", $next)) : ">") ."</small></td></tr>\n"; + $output .= "<div class=\"calendar\">"; + $output .= "<table width=\"100%\">\n"; + $output .= " <tr><td colspan=\"7\" class=\"header-month\">". l("<", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l(">", "archive/". date("Y/m/d", $next)) : ">") ."</td></tr>\n"; // First day of week (0 => Sunday, 1 => Monday, ...) $weekstart = variable_get("default_firstday", 0); @@ -54,9 +56,9 @@ function archive_calendar($original = 0) { // Generate the days of the week: $firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994); - $output .= " <tr>"; + $output .= " <tr class=\"header-week\">"; for ($i = 0; $i < 7; $i++) { - $output .= "<td align=\"center\"><small>". substr(ucfirst(t(date("l", $firstcolumn + $i * 86400))), 0, 1) ."</small></td>"; + $output .= "<td>". substr(ucfirst(t(date("l", $firstcolumn + $i * 86400))), 0, 1) ."</td>"; } $output .= "</tr>\n"; @@ -69,26 +71,27 @@ function archive_calendar($original = 0) { // Set up blank days for first week of the month: if ($first != $weekstart) { $blankdays = ($first - $weekstart + 7) % 7; - $output .= " <tr><td colspan=\"$blankdays\"> </td>\n"; + $output .= " <tr class=\"row-week\"><td class=\"day-blank\" colspan=\"$blankdays\"> </td>\n"; $first = $weekstart; } - // Start every week on a new line: if ($sday == $weekstart) { - $output .= " <tr>\n"; + $output .= " <tr class=\"row-week\">\n"; } // Print one cell: $date = mktime(0, 0, 0, $month, $nday, $year); - if ($date == $requested) { - $output .= " <td align=\"center\"><small><b>$nday</b></small></td>\n"; + $output .= " <td class=\"day-selected\">$nday</td>\n"; + } + else if ($date == $start_of_today) { + $output .= " <td class=\"day-today\">". l($nday, "archive/$year/$month/$nday") ."</td>\n"; } - else if ($date > $today) { - $output .= " <td align=\"center\"><small>$nday</small></td>\n"; + else if ($date > $end_of_today) { + $output .= " <td class=\"day-future\">$nday</td>\n"; } else { - $output .= " <td align=\"center\"><small>". l($nday, "archive/$year/$month/$nday", array("style" => "text-decoration: none;")) ."</small></td>\n"; + $output .= " <td class=\"day-link\">". l($nday, "archive/$year/$month/$nday") ."</td>\n"; } // Start every week on a new line: @@ -105,10 +108,10 @@ function archive_calendar($original = 0) { // Complete the calendar: if ($sday != $weekstart) { $end = (7 - $sday + $weekstart) % 7; - $output .= " <td colspan=\"$end\"> </td>\n </tr>\n"; + $output .= " <td class=\"day-blank\" colspan=\"$end\"> </td>\n </tr>\n"; } - $output .= "</table>\n\n"; + $output .= "</table></div>\n\n"; return $output; } diff --git a/modules/archive/archive.module b/modules/archive/archive.module index 3bb06ebae..51ca1db35 100644 --- a/modules/archive/archive.module +++ b/modules/archive/archive.module @@ -10,7 +10,8 @@ function archive_system($field){ function archive_calendar($original = 0) { // Extract today's date: - $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); + $start_of_today = mktime(0, 0, 0, date("n", time()), date("d", time()), date("Y", time())); + $end_of_today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); // Extract the requested date: if (arg(0) == "archive" && arg(3)) { @@ -18,14 +19,14 @@ function archive_calendar($original = 0) { $month = arg(2); $day = arg(3); - $requested = mktime(23, 59, 59, $month, $day, $year); + $requested = mktime(0, 0, 0, $month, $day, $year); } else { $year = date("Y", time()); $month = date("n", time()); $day = date("d", time()); - $requested = $today; + $requested = $end_of_today; } // Extract first day of the month: @@ -42,8 +43,9 @@ function archive_calendar($original = 0) { // Generate calendar header: $output .= "\n<!-- calendar -->\n"; - $output .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n"; - $output .= " <tr><td align=\"center\" colspan=\"7\"><small>". l("<", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l(">", "archive/". date("Y/m/d", $next)) : ">") ."</small></td></tr>\n"; + $output .= "<div class=\"calendar\">"; + $output .= "<table width=\"100%\">\n"; + $output .= " <tr><td colspan=\"7\" class=\"header-month\">". l("<", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l(">", "archive/". date("Y/m/d", $next)) : ">") ."</td></tr>\n"; // First day of week (0 => Sunday, 1 => Monday, ...) $weekstart = variable_get("default_firstday", 0); @@ -54,9 +56,9 @@ function archive_calendar($original = 0) { // Generate the days of the week: $firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994); - $output .= " <tr>"; + $output .= " <tr class=\"header-week\">"; for ($i = 0; $i < 7; $i++) { - $output .= "<td align=\"center\"><small>". substr(ucfirst(t(date("l", $firstcolumn + $i * 86400))), 0, 1) ."</small></td>"; + $output .= "<td>". substr(ucfirst(t(date("l", $firstcolumn + $i * 86400))), 0, 1) ."</td>"; } $output .= "</tr>\n"; @@ -69,26 +71,27 @@ function archive_calendar($original = 0) { // Set up blank days for first week of the month: if ($first != $weekstart) { $blankdays = ($first - $weekstart + 7) % 7; - $output .= " <tr><td colspan=\"$blankdays\"> </td>\n"; + $output .= " <tr class=\"row-week\"><td class=\"day-blank\" colspan=\"$blankdays\"> </td>\n"; $first = $weekstart; } - // Start every week on a new line: if ($sday == $weekstart) { - $output .= " <tr>\n"; + $output .= " <tr class=\"row-week\">\n"; } // Print one cell: $date = mktime(0, 0, 0, $month, $nday, $year); - if ($date == $requested) { - $output .= " <td align=\"center\"><small><b>$nday</b></small></td>\n"; + $output .= " <td class=\"day-selected\">$nday</td>\n"; + } + else if ($date == $start_of_today) { + $output .= " <td class=\"day-today\">". l($nday, "archive/$year/$month/$nday") ."</td>\n"; } - else if ($date > $today) { - $output .= " <td align=\"center\"><small>$nday</small></td>\n"; + else if ($date > $end_of_today) { + $output .= " <td class=\"day-future\">$nday</td>\n"; } else { - $output .= " <td align=\"center\"><small>". l($nday, "archive/$year/$month/$nday", array("style" => "text-decoration: none;")) ."</small></td>\n"; + $output .= " <td class=\"day-link\">". l($nday, "archive/$year/$month/$nday") ."</td>\n"; } // Start every week on a new line: @@ -105,10 +108,10 @@ function archive_calendar($original = 0) { // Complete the calendar: if ($sday != $weekstart) { $end = (7 - $sday + $weekstart) % 7; - $output .= " <td colspan=\"$end\"> </td>\n </tr>\n"; + $output .= " <td class=\"day-blank\" colspan=\"$end\"> </td>\n </tr>\n"; } - $output .= "</table>\n\n"; + $output .= "</table></div>\n\n"; return $output; } diff --git a/themes/marvin/marvin.css b/themes/marvin/marvin.css index 43f120743..6004cff2e 100644 --- a/themes/marvin/marvin.css +++ b/themes/marvin/marvin.css @@ -24,3 +24,8 @@ img { table { font-size: 1em; } +.calendar .day-today { background-color: #ccc; } +.calendar .day-selected { background-color: #bbb; } +.calendar .header-month { background-color: #ddd; } +.calendar .header-week { background-color: #ccc; } +.calendar .day-blank { background-color: #ddd; } diff --git a/themes/xtemplate/xtemplate.css b/themes/xtemplate/xtemplate.css index e25573a1e..5ee188abb 100644 --- a/themes/xtemplate/xtemplate.css +++ b/themes/xtemplate/xtemplate.css @@ -179,3 +179,11 @@ table { padding: 10px 10px 10px 0; border-bottom: 1px solid #ddd; } +.calendar td { padding: 0; border-color: #888; } +.calendar .row-week td a { padding: 2px; } +.calendar .day-today { background-color: #69c; } +.calendar .day-selected { background-color: #369; color: #fff;} +.calendar .header-month { background-color: #bbb; } +.calendar .header-week { background-color: #ccc; } +.calendar .day-blank { background-color: #ccc; } +.calendar .row-week td a:hover { background-color: #fff; color: #000; } |