Calendar Plugin 0+6i
Calendar's been updated.
Feature changes:
- New configuration variable
$first_dowlets you control which day of week weeks start with - New variable
$countavailable in templates, the number of stories in the day/week/month/year - Besides
$year_calendar, year calendars are built for each year from the current year back to the first year with stories, named$year_calendar_2003and so on. - The default templates include story counts in appropriate places.
- When generating a month calendar for year with no month specified, choose the last month in the year with stories in it, rather than always choosing December; use December if the year has no stories at all.
- When saving the cache, try to create the plugin state dir if it doesn't exist.
- When counting stories, ignore any stories with a timestamp that matches
$^T. This does mean that during the second a new story is posted, a generated calendar may not be quite right, but also makes the cache work much better with plugins that dynamically create 'stories' that shouldn't get counted, so long as they set the timestamp to$^T(such as a not-yet-released version of AutoCorrect) -- that's the whole point of these$^Tchanges.
Bug Fixes:
- In month calendar, include 'week_foot' for partial last week, if there is one (ie, include the final
<tr>) - Clear the cache if the day changes, not just when stories are added
- Properly count the number of stories to tell when to clear the cache; 0+5i accidentally used the number of hash buckets filled rather than the number of items in the hash -- oops
- If a year before 1970 is (apparently) requested, forcibly switch to year 2000 and log the full requested path, to try to figure out what causes this. Earlier versions would die when trying to build the month calendar. If you see "Bad year ... requested" lines logged, please let me know.
Changed for reasons only I care about:
- Use
$^Trather thantimein various places
Things I'd like to be able to do, but can't reasonably without Blosxom changes:
- use the built-in interpolation system, including any interpolate plugin that's installed
- create months for appropriate dates in static mode
To install:
- download and unzip the plugin.
- Copy it to your plugins directory. Make sure it's world-readable.
- Modify a
headorfootfile to include$calendar::calendar,$calendar::month_calendaror$calendar::year_calendar - Try it out — load your blog in your browser. If you see a calendar, great!
- Look at your error log. Verify you have an 'enabled' line.
- If you're wanting to verify caching is working, load the page again, and now look for an error log line "calendar debug 1: Using cached state"
- Once you're satisfied it's working, edit the
$debug_levelconfiguration variable to0. There are a couple other configuration variables you may wish to change, too. - Drop me a note to let me know you're using it; if you're having problems, let me know and I might be able to help. If everything's working okay, please let me know that, too.
Molelog is running this, with some customized templates and stylesheets.
.calendar { }
.calendar table {
margin-left: auto;
margin-right: auto;
}
.calendar table .prev-link {
margin-left: 0;
text-align: left;
}
.calendar table .next-link {
margin-right: 0;
text-align: right;
}
.month-calendar, .year-calendar {
border-collapse: collapse;
}
.month-calendar-head, .year-calendar-head {
font-size: 110%;
font-weight: bold;
}
.month-calendar-day-head, .year-calendar-subhead {
font-weight: normal;
}
.month-calendar {
text-align: center;
}
.month-calendar-day-noday,
.month-calendar-day-link,
.month-calendar-day-nolink,
.month-calendar-day-this-day,
.month-calendar-day-future {
font-family: Georgia,New Century Schoolbook,Times,serif;
}
.year-calendar-month-link,
.year-calendar-month-nolink,
.year-calendar-this-month,
.year-calendar-month-future {
}
.month-calendar-day-future, .year-calendar-month-future {
color: #83660F;
}
.month-calendar {
background: #fff3de;
border: 1px solid #83660f;
}
.calendar th {
border-bottom: 1px dotted #83660f;
}
.Saturday {
border-left: 1px dotted #83660f;
}
.Sunday {
border-right: 1px dotted #83660f;
}
.Saturday, .Sunday {
background: #f5deb3;
}
.month-calendar-day-this-day, .year-calendar-this-month {
background: #a5e4ff;
}
.year-calendar {
background: #fff3de;
border: 1px dotted #83660f;
}
calendar.calendar.html":http://molelog.molehill.org/blog/flavours/html/":
<div class="calendar">
<table>
<tr>
<td colspan="2">$calendar::month_calendar</td>
</tr>
<tr>
<td class="prev-link">$prev_month_link</td>
<td class="next-link">$next_month_link</td>
</tr>
</table>
<table>
<tr>
<td>$calendar::year_calendar_2001</td>
<td>$calendar::year_calendar_2002</td>
<td>$calendar::year_calendar_2003</td>
</tr>
</table>
</div>
<table class="month-calendar">
<caption class="month-calendar-head">
<a title="$monthname $year ($count stories)" href="$url">
$monthname $year
</a>
</caption>
calendar.next_month_link.html:
<a title="$monthname $year ($count)" href="$url"> $monthabbr '$year2digit→ </a>
calendar.next_month_nolink.html:
→
calendar.next_year_link.html:
<a title="$year ($count)" href="$url"> '$year2digit → </a>
calendar.next_year_nolink.html:
→
calendar.prev_month_link.html:
<a title="$monthname $year ($count)" href="$url"> ← $monthabbr '$year2digit </a>
calendar.prev_month_nolink.html:
←
<a title="$year ($count)" href="$url"> ← '$year2digit </a>
calendar.prev_year_nolink.html:
←
<table class="year-calendar">
<caption class="year-calendar-head">
<a title="$year ($count)" href="$url">$year</a>
</caption>
2003-04-13 21:32:00 | Comments (20) | TrackBack (0) | Computers::Internet::Web::Blosxom::Plugins::Calendar