Domino Workspace: The blog calendar
I wanted to make the calendar a little more intuitive. For each day:
- No link is rendered if 0 posts on that day.
- A direct link to the post is generated if there was only one that day.
- If more than 1 post on that day, the link goes to an overview of all the posts of that day.
Getting the number of posts for all days
Before I start building the calendar, I store the number of posts and the viewEntry number in arrays:
Dim days(31,1) As Integer
Set view=ws.db.getView("byMonth")
Set vc=view.GetAllEntriesByKey(room.UniversalID)
For i=1 To vc.count
Set entry=vc.GetNthEntry(i)
p=Day(entry.ColumnValues(2))
days(p,0)=days(p,0)+1
days(p,1)=i
Next
Rendering each calendar day
When creating each day of the calendar, I choose to display a direct link to the post, a link to an overview of the posts of that day or no link at all:
p=Day(dDay.DateOnly)
Select Case days(p,0)
Case 0
ws.body |<td| & cssClass & |>| & p & |</td>|
Case 1
Set entry=vc.GetNthEntry(days(p,1))
label=entry.ColumnValues(4)
href=path & entry.ColumnValues(3)
ws.body |<td| & cssClass & | title="| & label & |"><a href="| & href & |">| & p & |</a></td>|
Case Else
label=days(p,0) & " posts"
href=roomPath & Format(dDay.DateOnly,"yyyy-mm-dd")
ws.body |<td| & cssClass & | title="| & label & |"><a href="| & href & |">| & p & |</a></td>|
End Select
The result
You can see the result in the Blog rooms, e.g. in Random Observations, a test blog by Tim Tripcony.
Comments
08/09/2007 05:51:44, Mike Amberg
One more small step would be to have a Day-At-A-Glance list between the Calendar and the Archive showing the current days items ...
p.s. the registration process returned a garbage screen ... i took a screenshot but could not find anywhere to send it ...
08/09/2007 07:06:18, Brian McDowell
This is cool. Keep up the good work.
-Brian-
08/09/2007 09:43:46, Michel Van der Meiren
@Mike: I could not reproduce the garbage... but you can send it: michelv AT emd DOT be. I'm not sure what you mean by "Day-At-A-Glance".
To add a comment, log in or register as new user. It's free and safe.