Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
At the moment only the current month gets loaded. In the month view we can see aditional days of the previous and next month. We should load the events for those as well.
If we use a 14 days buffer, we are safe.
Comment | File | Size | Author |
---|---|---|---|
#25 | 1279588-d7-9.patch | 14.05 KB | redndahead |
#23 | fullcalendar-1279588-23.patch | 14.05 KB | tim.plunkett |
#22 | fullcalendar-1279588-22.patch | 13.98 KB | tim.plunkett |
#21 | fullcalendar-1279588-21.patch | 6.98 KB | tim.plunkett |
#19 | 1279588-d7-8.patch | 4.9 KB | redndahead |
Comments
Comment #1
aspilicious CreditAttribution: aspilicious commentedThis is postponed because we can't filter on a date range.
Comment #2
tim.plunkettRelevant bits of code:
Date module parses a single date into a range of itself to itself. So 2011-11 becomes 2011-11 to 2011-11.
http://drupalcode.org/project/date.git/blob/refs/heads/7.x-2.x:/date_api...
This is where we add our value:
http://drupalcode.org/project/fullcalendar.git/blob/refs/heads/7.x-2.x:/...
This is where we check for it:
http://drupalcode.org/project/fullcalendar.git/blob/refs/heads/7.x-2.x:/...
Comment #3
redndahead CreditAttribution: redndahead commentedOk so here is what I found out
If in fullcalendar.fullcalendar.js around line 50 you replace
with this
It'll work when moving between months, but not when the calendar is loaded. I can't figure out where it sets the default date in the initial view. All we would need to do was pass it a range like 2011-10--2011-12 and it will get all the events for October, November and December. Technically we could pass it 2011-10-30--2011-12-03 and we would get the events for the showing month. But we would have to calculate what is the first date showing. This may take some work when having to consider what the user chose as the first day of the week.
Any ideas?
Comment #4
tim.plunkettSee #1353102: Custom initial date is broken for why initial dates are different/broken.
Comment #5
redndahead CreditAttribution: redndahead commentedHere is a patch that is a proof of concept of getting this to work. There are some assumptions made that might need to be changed or removed.
1) I create a default fixed value of a range from the previous month to the next month. probably needs to be checked for ajax being enabled.
2) I then parse that argument to get me the starting date for fullcalendar.
3) For every update using ajax I create a range of the previous month to the next month and use that as the argument.
Hopefully it's in the right direction.
Comment #6
redndahead CreditAttribution: redndahead commentedSeems that with ajax turned off it still works fine. Only issue I've found so far is if you try to set a default date. This patch fixes that.
Comment #7
aspilicious CreditAttribution: aspilicious commentedWhat happens on the end or the beginning of a year?
Does month: 13 year 2011 gets converted to january 2012?
Comment #8
redndahead CreditAttribution: redndahead commentedIt will get converted to january 2012. The strtotime function takes care of that for php and setMonth() takes care of that for javascript. Just noticed I left a couple console.log's in there. Will have to remove that.
Comment #9
aspilicious CreditAttribution: aspilicious commentedfeels like duplication :p
Comment #10
aspilicious CreditAttribution: aspilicious commentedI think we should fetch the first part of strtotime before this line. Preventing duplication...
I prefer next_date = prev_date; for performance reasons.
Comment #11
tim.plunkettCan we use something like
next_date = $.extend({}, prev_date);
to not run that twice?That, plus the duplicated lines, plus the console.log(). Otherwise, this makes a lot of sense.
Comment #12
tim.plunkettI think @aspilicious meant something like this:
Comment #13
redndahead CreditAttribution: redndahead commentedHere is an updated patch.
Comment #14
redndahead CreditAttribution: redndahead commentedHere is one without the $.extend() code that doesn't seem to be working.
Comment #15
redndahead CreditAttribution: redndahead commentedHere is the fixed date copy version.
Comment #16
tim.plunkettWith Ajax
Without Ajax
Comment #17
redndahead CreditAttribution: redndahead commentedThis one removes the $separator variable. Also it fixes the other 3 broken issues reported above.
Comment #18
redndahead CreditAttribution: redndahead commentedThis version limits the ajax queries to only the visible calendar dates.
Comment #19
redndahead CreditAttribution: redndahead commentedSome more cleanup with using formatDate()
Comment #20
tim.plunkettBrilliant.
I'm not quite sure I understand this line, and don't we just do
$settings['date']['month'] = $month - 1;
a couple lines down? Maybe we should comment why we do this here.I'll test all 6 cases again like in #16, but I think this looks really good.
Comment #21
tim.plunkettWith ajax, with a query string, nothing is loaded. Here is a patch that moves stuff around.
hook_fullcalendar_options_process is a terrible hook. It runs way too late for most things, and does too much.
Comment #22
tim.plunkettOkay, this finally breaks up the insanity of hook_fullcalendar_options_process.
Comment #23
tim.plunkettOkay, I hope we never again have to worry about zero-based vs one-based months.
This one works for me in all 6 cases.
Comment #24
tim.plunkett@redndahead said this worked in IRC, and I really want to commit this, but I should really let aspilicious double check.
Comment #25
redndahead CreditAttribution: redndahead commentedThis patch adds the fix from here since it's a small fix and we are already messing with that code. #1206518: Call a specific calendar view through the URL
Comment #26
tim.plunkettcross posted
Comment #27
aspilicious CreditAttribution: aspilicious commentedTested all the situations.
Comment #28
tim.plunketthttp://drupalcode.org/project/fullcalendar.git/commit/e5a8bf7
Awesome.
Now we just need to figure out http://drupal.org/node/1206742 and we're really pretty much done.