I use this module all the time, but the calendars don't look all that great. For instance, I cannot assign a different style to the caption (month name), the day headers, etc.
This is because the output of the calendar generation uses theme('table', $rows), where the rows are all table rows incluing the one for the caption, the headers, etc.
I have seen a more powerful theming function that takes rows, caption, and headers and generates HTML that includes table caption tags, th tags, etc. If this function were used, then the ability to style and theme the calendar display would be greatly improved.
Comments
Comment #1
Susurrus commentedI'm not sure in your last paragraph if you have existing code you'd like me to use or I should write my own theming function for this. If you know PHP, you're also encouraged to commit a patch for this feature.
Comment #2
Susurrus commentedOkay, well, I've looked at the code, and it's already in a theming function, so you're welcome to override this function in your own theme. I agree that this function could be improved more so that the actualy theming is separated from the data (an array of days with their content would be passed to a theming function), but I don't consider it a priority.
Comment #3
jrisberg commentedI know some PHP but not enough of the Drupal API, so I'm sending you this code rather than checking it in.
I have a better explanation of what I wanted now: in the function theme_archive_block_calendar($timestamp), there is a call to theme('table', ...). This is fine, but the table generation also support creating a caption and a header, if additional args are specified. So in the version that I'm proposing, there is call at the end that reads: return theme('table', $day_titles, $rows, array(), $month_title);
The full code is :
Then I can use a stylesheet with rules like the following, and style the header, the caption, and the rows differently.
Hope that you find this of interest. This was the first time that I have traced through the themeing logic of Drupal.
Comment #4
Susurrus commentedWhile I'm doing this I would like to refactor the theming function to better uphold MVC principles and so the theme function should be passed all the date formatting information it needs and then it just displays it without any extra logic in there. Currently, this is not the case. I have been developing a new version of this function as well as hook_block() obviously, but it wouldn't hurt if you might take a stab at it. Them grad apps are a tad more important right now...
Comment #5
Susurrus commentedPatch is against 5.x-1.x-dev since that wraps up a ton of changes that will be rolled out as the next version. Download that, apply this patch, and tell me if it works for ya.
Comment #6
jrisberg commentedThanks for the reply. Glad to see that you have incorporated my change in the patch. I believe we are on the same wavelength.
* Regarding basic testing, unfortunately I am running 6.0 RC1, so I can't test your patch effectively. Community: can someone else try this?
* Regarding refactoring the function including hook_block()... I don't have the Drupal skill set to do that. I know enough PHP, but am still learning the Drupal API.
Good luck on the grad apps!
Comment #7
Susurrus commentedRerolled against HEAD.
Comment #8
Susurrus commentedApplied to head and 5.x
Comment #9
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #10
jmpacquet commentedI applied the patch on top of my (already patched for PostgreSQL) archive.module which was originally a 5.7-1.9 version.
It works for me.