Hi,

I created a patch that provides litecal/google like theming of multi-day events. This will have events "span" multiple columns if it starts/end over a multi day period. Specifically, this patch provides:

  1. Multi-day layout for month and week view
  2. A new option in the Views style options for month & week views to enable/disable multi-day support
  3. Restyled layout of month & week calendar to give the calendar a lighter look - it's looks more like google or litecal
  4. Support for striping and limits on items/day

Additionally, I've tested against as many use cases as possible - I've gone through all the options for the week and month view options - and verified that the patch supports/doesn't break them. I've run it through the coder module - and I haven't added any complaints. Additionally, tested on ie6/ie7/ie8/ff/safari/chrome/opera.

This patch introduces two new tpl files - so if applying, you may need to clear the cache (not totally sure about this - if someone can provide clarity regarding template caching, that would be great).

- x

Screenshots :
http://www.okeel.com/sites/okeel.com/files/multi-day.png
http://www.okeel.com/sites/okeel.com/files/multi-day-week.png

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

developer-x’s picture

FileSize
57.64 KB

I've fixed a couple of bugs:

  • Possible duplication of events when a multi-day event is marked as "all-day"
  • Height of singleday events can miscalculated for ie and ff browsers

Also, there is now a live demo of this patch at http://www.okeel.com/demo/calendar

Fogg’s picture

+1

i will run a test of this soon, looks very interessting.

retsamedoc’s picture

Doesn't work for me. I get a bunch of <'s on my calendar page (month view is broken; day & year view looks fine). This is using calendar-2.2 w/ the patch in 1.

developer-x’s picture

Just to double check - did you flush the caches after applying? There are a couple of new templates that need to be read into the template cache. If that doesn't work, can paste some of the html source around the "<" you are seeing. The actual output will help pinpoint what's happening.

retsamedoc’s picture

Flushed the caches and I still see the same issue. I am not using APC or memcached, just vanilla Apache/PHP.

      <div class="calendar-calendar"><div class="month-view">
<table width=100%>
  <thead>
    <tr>
              <th class="days week">
          &nbsp;        </th>
              <th class="days sun">
          Sunday        </th>

              <th class="days mon">
          Monday        </th>
              <th class="days tue">
          Tuesday        </th>
              <th class="days wed">
          Wednesday        </th>
              <th class="days thu">

          Thursday        </th>
              <th class="days fri">
          Friday        </th>
              <th class="days sat">
          Saturday        </th>
          </tr>
  </thead>

  <tbody>
          <tr>
                  <td id="<" class="<">
            <          </td>
              </tr>
          <tr>
                  <td id="<" class="<">
            <          </td>

              </tr>
          <tr>
                  <td id="<" class="<">
            <          </td>
              </tr>
          <tr>
                  <td id="<" class="<">
            <          </td>

              </tr>
          <tr>
                  <td id="<" class="<">
            <          </td>
              </tr>
          <tr>
                  <td id="<" class="<">
            <          </td>

              </tr>
      </tbody>
</table>
</div></div>
developer-x’s picture

Do me a favor, zip up your calendar module directory and include it here. I'll download it and debug it.

- x

retsamedoc’s picture

FileSize
492.06 KB

Okay, here it is. This version is what I want to run since it includes your multi-day patch and the iCal export fix.

developer-x’s picture

I applied it - worked just fine.

I noticed in your output, you have <table width=100%>. That isn't part of the tpl files as part of the calendar package. Do you have a tweaked calendar? With my patch, the themes have changed - so if you have a custom tpl file, you need to rework it to conform to the changed template files.

mariomc’s picture

+1

Thank you kind sir.

Subscribing.

retsamedoc’s picture

Hm. It works great using the Garland theme but not using Zen or derivatives. I'll investigate further. Thanks for the help!

developer-x’s picture

I just tried it in zen - seemed ok. You may have some custom styling that is conflicting. If you want, include a screenshot - that might help me pinpoint some of the styles in question.

mariomc’s picture

I tried with a fusion sub-theme and no problem was found as well.

lelizondo’s picture

Patch works great with a custom theme.

developer-x’s picture

FileSize
112.07 KB

Here is a new version of the patch. It adds the following functionality:

1. Overlapping view of weekly and daily events - items in the weekly and daily views now "span" over the timeslots and events which are concurrent appear to overlap
2. New options in the view for week and day to enable the ovelapping views
3. css layout fixes for ie and ff
4. javascript enable weekly and daily view to allow resizing and positioning of the views. This is not dependent functionality - everything should work ok without javascript.

This patch replaces the previous patches. If you have applied a previous patch, you will need to revert then apply this patch.

This patch introduces two new templates - so you will need to flush your template cache

For a demo of the new functionality, goto http://www.okeel.com/demo/calendar/2010-W42

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

Absolutely what I needed. Other than breaking my custom CSS (which was to be expected), this worked 100% out of the box.
I'll take some time to look through the code in-depth tomorrow.

developer-x’s picture

Cool - I'm glad it worked. I plan on having an update to this patch to better layout in ie (it doesn't handle tables as well as the other browsers ff/safari/chrome/opera... *sigh*) and I want to provide data oriented attributes to the html elements to make the calendar jquery inspectable so that it can be decorated with interesting ajax/javascript functionality. This will be last planned feature update. I'll update with bug fixes as they're discovered.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned

I'm encountering a problem with multi-day events near the end of the month, in month view.
An all-day event from Oct 5 (Tuesday) to Oct 11 (Sunday) displays fine.
However, an all-day event from Oct 26 (Tuesday) to Oct 31 (Sunday), doesn't display Saturday.

I think this is due to the "remaining days of week/month" code, and I think this is the fix.

$diff = ($view->date_info->granularity == 'month') ? date_difference($last_day, $curday_obj, 'days') + 1 : date_difference($last_day, $curday_obj, 'days') - 1;

Note the added " + 1" in the TRUE half of the ternary. This displays the event properly.

tim.plunkett’s picture

Status: Needs review » Needs work

Nope, that breaks events at the end of the month, and displays them one day past the end of the month (if they extend that far).

The lack of differentiation between "end of month" and "end of week" is breaking this. I might get back to this later, but perhaps you, knowing your code better, can figure it out.

developer-x’s picture

Tim,

What is the exact start and stop time of the 10/26-10/31? Let me try to reproduce this

tim.plunkett’s picture

10/26/2010 12:00AM (All Day)
10/31/2010 12:00AM (All Day)

tim.plunkett’s picture

Status: Needs work » Needs review

Removing the following line fixes the problem:
$remaining_days = ($view->date_info->granularity == 'month') ? $remaining_days - $wday : $remaining_days;

I'm not sure the intention of that line, but the min(6, $diff) would take care of truncating the remaining days.

developer-x’s picture

Tim,

Thanks for reporting this, the fix is as follows:

$diff = ($view->date_info->granularity == 'month') ? date_difference($last_day, $curday_obj, 'days') : date_difference($last_day, $curday_obj, 'days') - 1;
$remaining_days = ($view->date_info->granularity == 'month') ?  min(6 - $wday, $diff) : $remaining_days;

What the first line does is figure out how many days remain for the event based off the date being rendered. The second line makes sure we don't exceed past the current week. You have to subtract the $wday because if you are on Thursday, you want the colspan to be only 2 - not 6.

I'll get an updated patch with this fix hopefully soon.

tim.plunkett’s picture

The last line should end with : $diff;, because $remaining_days doesn't exist yet otherwise.

But, I find this much easier to read, and it doesn't repeat the same if() twice:

$diff = date_difference($last_day, $curday_obj, 'days');
$remaining_days = ($view->date_info->granularity == 'month') ? min(6 - $wday, $diff) : $diff - 1;

Now that this has been resolved, is there a plan for finalized code, and not just a patch?
For this to be useful in the long term, it needs to live as optional code or a submodule, not a functionality-altering patch.

developer-x’s picture

DOH (hand-slapping-forehead) - this what I get for trying to doing several things at once! But, I like this fix - let's hear it for collaboration!

Regarding finalizing code - that isn't up to me - I'm not a maintainer of this module. Unfortunately, there isn't really a way to make this a submodule - it needs to be incorporated into the calendar module codebase directly.

My thinking was if this got adoption and was thoroughly QAed - then we can make a good case for incorporating it.

tim.plunkett’s picture

Status: Needs review » Needs work

There are dozens of code changes made that aren't directly related to the new functionality. Most importantly, keeping the existing APIs intact and functioning. For example, it looks like you renamed calendar_build_month() to calendar_build_mini_month(), and used the name calendar_build_month() for something entirely different. Also, changes like

-  border-top:1px #333 dotted;
+  border-top:1px solid #CCCCCC;

shouldn't be made directly, they could be in an alternate CSS file loaded only for the alternate functionality.

Basically, we need to take this wonderfully functioning code, and make it work without hacking the module.

Also, take #956282: Coding standards into consideration, your patch introduces quite a few tabs, trailing spaces, and coding style "bugs".

arlinsandbulte’s picture

Subscribe.
This looks REALLY promising! (although I have not tested anything yet)
Karen made me co-maintainer, so I might be able to help out, although this kind of big change might be something Karen needs to be involved with.

If we can Tim's issues in #25, I might take a closer look at committing this (might mean a 6.x-3.x release).

I also agree with Tim in #23 that it would be best if this new functionality was an optional feature. Is that doable?

Also, and this might be a separate issue, has anyone looked at how easily this might port to the D7 version of calendar?

mixedfeelings’s picture

First off, I am REALLY excited about this patch! Thanks for working on it!

Secondly, I am basically a drupal newbie, so I apologize if there is something obvious I missed in the following scenario:

I implemented Tim.Plunkett's changes in #23, and tried to patch it locally (I don't have shell access to my host). but came up with the following area when I implemented the patch:

$ patch < calendar-multi-day_4.patch
patching file calendar-overlap.css
patching file calendar.css
patching file calendar.module
can't find file to patch at input line 1365
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: includes/calendar.inc
|===================================================================
|RCS file: calendar/includes/calendar.inc,v
|retrieving revision 1.1.2.40
|diff -u -p -r1.1.2.40 calendar.inc
|--- includes/calendar.inc	11 May 2009 22:24:27 -0000	1.1.2.40
|+++ includes/calendar.inc	22 Oct 2010 21:40:10 -0000
--------------------------
File to patch:                 
Skip this patch? [y] y
Skipping patch.
patch: **** malformed patch at line 1836: @@ -169,7 +571,7 @@ function calendar_build_day($curday, $vi

Am I patching the wrong version of Calendar?

Thanks in advance!

developer-x’s picture

Did you apply tim's fix, then appy the patch? If so, that won't work (it will confuse the patching process).

You need to first apply the patch from #14, then go in and hand code Tim's change from #23.

I will have an update soon that will have the fix from #23 (also, I'll have a cogent response to #26, #27 soon as well).

developer-x’s picture

FileSize
89.45 KB
89.88 KB
129.54 KB

Here is a patch with the fix from #23. Also, if you are having problems getting the overlap display to work for the week and day view - you may need to goto your view and set/save the display options to overlap. Screenshots enclosed:

KarenS’s picture

I think this looks interesting but I have a lot of questions about things like adding/altering core functions like calendar_build_week(). What is the purpose of the new 'mini' versions of each of them? What happens on the week, year, and day view? Also as mentioned above there are lots of things coming through as changes that aren't changes because of whitespace or whatever which makes a big patch even harder to read. It would help if the patch could be cleaned up to only include actual changes.

I had just been looking at the litecalendar code that Development Seed has come up with which gives this kind of month view and that code is considerably simpler. I was trying to see if we can merge the approaches to simplify the code and unfortunately this patch complicates the code rather than simplifying it.

But it looks very interesting.

KarenS’s picture

Oh, another question is about all the css items like '.calendar-calendar div.single-day .d_38 .view-item .calendar'. Do all those item numbers handle every possible iteration or is it possible that someone with a ton of items would end up with too many items that the css would not catch? I'm trying to understand where that is set and how it is used.

Is there any way to simplify all that css? It appears fragile -- very specific to a certain theme or number of items. I usually avoid setting height and width values in pixels because you don't know how much screen space is available. What happens in a theme that has a very narrow center column? Will the calendar still fit?

tim.plunkett’s picture

Wow, litecal is really slick. It uses DIVs instead of TABLEs, and it does everything either on the theme layer or as a views plugin, so it doesn't require hacking the calendar module.

I spent some time today and forked it on github to add rudimentary week support (it only came with support for a month view). It basically treats all events like multiday events, that is, it doesn't include any sort of hourly grid on week view.

At this point I'm not really sure which approach to continue working on. I guess that will depend on how Development Seed wants things to proceed with litecal. I submitted a pull request, so hopefully I'll hear back from them soon.

developer-x’s picture

FileSize
93.43 KB
89.06 KB

Karen, Tim, et al.

I want to respond to all your questions. This is a major refactoring, so I'll do my best to address issues and explain my thinking (my method to my madness, so-to-speak).

Background

When I started looking into how to improve the calendar, I spent quite a bit time researching how litecal, fullcalendar, and google implemented their calendars. I decided that there were some real problems with all of their approaches. A non-comprehensive list:

  • All rely on fixed heights for the multi-day and singleday events. This caused events to needlessly get cut off when viewing the items
  • All have equal widths for days and their layouts depend on this. This prevents someone, for example, from giving Sunday a greater width than the rest of the days of the week (I need this)
  • Google and fullcalendar used javascript for the layout algorithms and Google aggressively hide their events as events were added
  • All have hardwired inline styles for height/widths/offsets which makes it difficult to restyle
  • Litecal doesn't support year/month/day
  • Litecal has a naive layout algorithm, it doesn't make efficient use of vertical spacing

Giving this all a lot thinking, I put together the following list of requirements/goals/constraints (in no particular order):

  1. Build off the calendar module
  2. Theme multi-day events like Google/fullcalendar/litecal
  3. Theme single-day events like they are currently in the calendar module
  4. No inline styling. Use strictly class definitions
  5. Allow flexible heights and width
  6. No requirements on javascript
  7. Allow total flexibility regarding content output (Not just time and title)
  8. Maximize space efficiency
  9. Clear, clean styling out-of-the-box, requiring very little additional styling
  10. Preserve all existing calendar functionality while adding new functionality
  11. Decorate elements with data attributes so that jquery based code can inspect the calendar and provide additional functionality

In order to implement items 2-3, I would need to keep using a table (unlike litecal). That way the content as delivered would govern heights and widths and the rendering would be done by the browser. But I would have to calculate colspan/rowspan.

My first stab at implementation, I tried an add-on module approach. But it came clear to me early that I would have to refactor the month/week/view processing to for all of this to work. The reason for this is that calendar "themes-as-is-goes". Instead, I need to collect the data, calculate rowspans/colspans/continuations/offsets/indents/ and a lot of other stuff. Only then, can I start theming. Calendar doesn't providing any sort of hooks to do this. So, I had to either create a competing calendar module or refactor the code. Since I didn't want to replicated/duplicate code unnecessarily, I chose to refactor via patch.

The general approach I chose was to create a bucketing systems. There are two buckets : multi-day buckets and single-day buckets. By creating a set of buckets, I was able to efficiently layout multi-day events - I can "compact" and I can properly calculate rowspan/colspan. Additionally, I deconstructed the table themeing - there are now separate themes for columns and rows. So, it's much easier to properly extend this module going forward.

Questions/Comments

What is the purpose of the new 'mini' versions of each of theme?
For the calendar block and in the year view, the view is qualified as 'mini' $view->date_info->mini. I had no desire/need to change anything about this display - so the old code is 'preserved' - porting it to the new rendering techniques was really out of the scope of this effort. So, the function was renamed to calendar_build_mini_month to be clear as to the purpose of this function - it was only for the 'mini' displays
There are lots of things coming through as changes that aren't changes because of whitespace or whatever
I ran the base calendar thru coder - there were a lot of flags. I decided not to address those issues as part of this patch - but I myself wouldn't add any additional coding flags. However, tim pointed out that I had added some whitespaces. So I globally changed the whitespace. If that is too confusing - I'd be happy to revert those changes
I was trying to see if we can merge the (litecal) approach(es) to simplify the code and unfortunately this patch complicates the code rather than simplifying it
Yes, the code is a bit complicated - but it's not gratuitous complexity - it brings a lot of value that litecal can't deliver. As I mentioned already, litecal isn't really simple - it's a "naive" implementation. It doesn't scale well. See the following screenshots to see what I mean (litecal.png and calendar.png). These snapshots are of the same dataset - you can see that my approach to layout renders this much more cleanly and clearly. In fact, if you notice, litecal doesn't even display all the events on 9/9 (actually, the calendar image is cutoff - but there are ten events on that day)

Additionally, once you try to tackle week/day with overlaps/idents/ etc, simple doesn't cut it. It's a complex problem and the code needs to handle it. The trick is to be clear and well documented. I tried very hard to add lots of comments and have rational variable names.
Is there any way to simplify all that css? It appears fragile -- very specific to a certain theme or number of items
There is room for improvement here. But as I pointed out, I wanted no inline styling - that means I created a lot different css classes to cover all use cases.

Unfortunately, because of the nature of overlap/indent/offsets in the day/view - I have to go with an absolute layout. That necessitates the need for fixed heights.
What happens in a theme that has a very narrow center column? Will the calendar still fit?
The month calendar will. The week/day view (assuming you've selected overlapping layouts) will not fit out of the box. The good news is that because there are no inline styles - this situation is "fixable" - you just redefine the associated css defintions
Basically, we need to take this wonderfully functioning code, and make it work without hacking the module.
Thank you for the kind compliment - but "hacking the module" - well, Thems fighting words!!. Seriously, I didn't take the decision to do this as a patch lightly - I believe I had very good, as well as, well-thought-through reasons to do so. In addition, at each point where I needed to refactor the base code - I carefully considered it. I'm not saying this patch is perfect, entirely bug-free or without room for improvements, but I believe that this patch actually leaves calendar in better shape than I found it.

In particular, the general approach that calendar was taking (theme-as-you-go) is not the correct approach. Data should be completely collected, then rendered. This patch refactors the calendar to use that approach. Additionally, with this patch, there are now more theming templates - giving more granular control over customization of the output.

So I'd rather characterize this patch not as a "hack" but a "refactor"

One thing I'd like to point out - this patch preserves the old layouts. So it can be applied and for those that want to still use the old layout can do so. Unfortunately, because of the required changes, the DOM structure is changed. Folks with custom templating and css will have to rework it. But I believe the benefits this patch brings outweighs the cost of redoing any tweaking.

Conclusion

I think for the calendar module to be a legitimate alternative to google/fullcalendar, we need to provide more sophisticated functionality. I believe litecal fills a niche - it's simple, and for a relatively small dataset, renders nicely. But it doesn't have the "meat" to build a more google like calendar. For that, we need to build off the calendar module.

Given the size of the patch, we might be better served to conduct a code-review of the resulting code rather than inspecting the patch. I'd be happy to try to organize something.

BTW, Karen - thank you so much for building the calendar module - it is crucial. I hope this patch actually helps progress the module.

developer-x’s picture

Tim,

I'm interested in where you end up with this. But I've had trouble getting litecal to work correctly. To see what I'm talking about, take a look at these two links:

http://www.okeel.com/litecal
http://www.okeel.com/demo/calendar

Take a look at 11/1 on the litecal output - it's missing "Pondelni florbal". Instead, it's displaying it on Tuesday. This is just one error - if you look closely, there a lot of errors. It strikes me that litecal's layout algorithms break down as the data gets complex. Seems like litecal is still in a pretty dev state.

I don't have any particular feeling one way or another - I admired litecal's simplicity. But it just doesn't seem up to the task of handling big datasets. My two cents....

tim.plunkett’s picture

Pondelni florbal is on 11/2 (and every Tuesday). Perhaps a timezone issue? Or maybe it is mishandling repeating events? Or both? Also, a side note about litecal. You need to turn off field-specific links within each event. It wraps events with a link, and while Firefox is okay with that, Webkit browsers choke on nested links.

After further work with your patch, litecal, and now fullcalendar, I'm not sure which to focus on. None of them do everything.

  • fullcalendar is the only one that stretches events vertically according to duration in Week or Day view. But it is completely jQuery-based, and doesn't yet support repeating dates or dates as arguments (deep-linking).
  • litecal has some problems, is almost too lightweight, and since it's not on drupal.org it's hard to file bug reports or feature requests.
  • And the magical Calendar patch of death (no offense!) is going to be a lot of work, if only because it alters existing functionality of a module that is used on 45000 sites. Also, it is proving difficult to fit into my custom theme, due to that crazy CSS.

Lastly, if it seems that I am criticizing design decisions made either in the writing of this patch, or in development of the calendar module itself, please don't take it negatively! If I am making a critique, it is not to disparage but to improve.

developer-x’s picture

FileSize
130.5 KB

This patch addresses undefined variable warnings. This patch supersedes previous patches.

Point of clarification : this patch does stretch events vertically according to duration. To see this, check out the following links:

http://www.okeel.com/demo/calendar/2010-W42
http://www.okeel.com/demo/calendar/2010-10-20

If you apply this and have trouble getting the overlapping views of the week and days, you will need go into the views, and modify the style options. See screen shots in comment #29.

DaPooch’s picture

This is a straight up bitchin patch... really needs to get into the dev stream as an essential new feature. Now if only this were combined with AJAX updateability and a little more flexibility on the default and block page styling (I don't use the views page since I need it to conform to node heirarchy so I embed a default view.) If it were navigable via ajax it would be sheer perfection.

Thanks so much for your contribution.

developer-x’s picture

Glad you like it! Regarding ajax capability - no promises - but stay tuned.....

Shadlington’s picture

Wow. This is awesome.
+1

albert855’s picture

FileSize
505.65 KB

Hi developer-x,

I have applied your patch in comment #36 and everything works just fine. However on the day view, events that are supposed to appear in the "All Day" row are appearing on the "Before 01:00" row. It works fine on the week and month view though. Here are the links:

Day:
http://demo.bypenguins.com/agape/calendar/2010-11-26
Week:
http://demo.bypenguins.com/agape/calendar/2010-W48
Month:
http://demo.bypenguins.com/agape/calendar/2010-11

I have also zipped and attached my calendar module for your reference. Your help is much appreciated!

developer-x’s picture

Hi,

Did you try going into your views and re-saving the week and day view? Reference #29 for an example. If you haven't, try it and see if that fixes the problem.

-x

albert855’s picture

Hi! That was quick.. I have already tried re-saving the week and day view as per comment #29, however the issue still persists. I have noticed this problem in your demo too?

When I created an all day meeting event, and I did not check the "All Day" checkbox, the event will not display under the "All Day" row (despite the to and from hours being 00:00 for both fields), much like the problem I am having now.

Is the "All Day" check box in your demo a custom field? The eventsbooking and booking API don't seem to provide such an option, though eventsbooking does but only under the configuration pages rather than on the "create node" page.

:)

developer-x’s picture

Hi! Thanks for pointing this out. I'll provide another patch with this fix soon (I have some other changes which aren't ready). In the meantime, if you goto calendar.inc and on line 591, replace:

            if ($item->calendar_all_day) {

with

            if ($item->calendar_start_date == $item->calendar_end_date) {

That will fix the problem. I've added and verified this fix on the demo site.

BTW, the all-day checkbox is include via this patch : http://drupal.org/node/370092#comment-2125366

albert855’s picture

Hi x! Thanks for your help and the excellent patch! Have a good day!

KarenS’s picture

I've tried and tried to find a way to apply this patch without errors and can't get it working. It definitely won't apply to the current dev code, and I've tried going back through a number of earlier versions to find some place where the patch will apply but can't find one.

Can someone who has this working please bring the patch up to date on the latest -dev version of Calendar so I can patch and test this?

KarenS’s picture

I finally figured out that the patch is against the last official release instead of the development snapshot, so I rolled back to that and applied the patch, and then updated to the latest code.

So I've gotten it working with the latest code. I like a lot of things in this patch, my biggest reservation is the theme changes that are probably going to be a problem on production sites that have adjusted to the previous theme.

I have to think about how to handle this -- suddenly making massive theme changes on production sites is not going to be acceptable, and this is in use on some very large production sites. This may have to go in as a new version unless there is some sort of backwards compatibility for the theme.

KarenS’s picture

I'm playing with something that looks like it may work -- moving all this new functionality into a separate module -- calendar_multiday -- such that the current code and themes all stay in place unless that module is enabled. I'm adding a number of if (module_exists()) tests to determine which theme files and css to load. I have to rename the core functions back to the original names and provide the multiday alternatives in the multiday module then add a switch to use the appropriate function based on whether multiday is enabled.

This is a little harder to get working, but provides the backward compatibility layer we need. I don't actually have it working yet, still trying this idea out.

KarenS’s picture

OK, I have this code pulled out into a separate module, calendar_multiday. If that module is disabled, things should work like they always have. If it is enabled, the regular calendar module lets it add its own theme and css. There are still some problems, but committing this much lets people work on this without breaking existing functionality for everyone else.

The new module has its own tpl, theme, and css files. Part of calendar.inc is the same for both displays and that code has been moved into the calendar.module. The part that is different goes into two different calendar.inc files and the right one is included depending on which display you want.

When you enable/disable the new module you get an error like this:

Fatal error: Cannot redeclare template_preprocess_calendar_main() (previously declared in .../calendar/theme/theme.inc:6) in .../calendar/calendar_multiday/theme/theme.inc on line 70

That's because we have a flash of time when both the original calendar and the new module are trying to handle the theme. The error will appear once and go away when you refresh the page. I need to try to come up with a workaround for that.

I got the old display looking the same and the new month display looks right, but something didn't quite make the transition in the day and week overlap view. I must have lost some code somewhere. Maybe someone can figure out a patch to get that working again.

KarenS’s picture

Status: Needs work » Needs review

Found the problem with the day and week view and committed that. I think this is ready for review. Enable the calendar_multiday module and edit the view style settings for the day, month, and week view.

arlinsandbulte’s picture

Have not tested this, but I hope to.
YOU ROCK, KAREN!

developer-x’s picture

Karen,

Wow! That is amazing work - I've download the dev branch and will play with it. Thanks so much for taking in this patch - I think the add-on module approach provides a good approach to backward compatibility.

I do want to simplify the css the and add in more data attributes to the markup. Should I start submitting patches against the multi-day module?

developer-x’s picture

Karen,

I have it all working - thanks for making this happen!

KarenS’s picture

Yes, additional functionality and cleanup can be submitted as patches. In additional to cleaning up the multiday code, we should see if there is more that can be made the same for both themes -- for instance, can we get the remaining code in calendar.inc to work the same in both themes so that the only difference is the theme and css files? There is probably more work that could be done to make the theme more easily pluggable -- set it up so you have a choice of the current theme, the multiday theme, and potentially some other theme that someone dreams up in the future. I don't have time to worry about that right now, but it would be a nice goal.

pfx’s picture

the calpopup is it supposed to work ? In my tests on my calpopup remains empty.

pfx’s picture

Version: 6.x-2.2 » 6.x-2.x-dev

In the week view and day view, my events do not appear. An exploration with Firebug shows a still hidden DIV for these views:
<div id="single-day-container" style="visibility: hidden;">
By replacing hidden by visible from Firebug then my events appear correctly.
What should I change in my setup.

KarenS’s picture

There is nothing about cal popup in this patch. Please follow the instructions:

1) Enable the calendar_multiday module
2) Edit your calendar view. Select each of the following displays and edit and save the style for each: month, week, day.
3) Save the view.
4) Clear your caches and make sure the view is not still using a cached version (go to the Views 'Tools' tab and be sure the views cache is emptied or not being used).

pfx’s picture

Thank you, I redid the procedure and emptying the cache view has solved my problem # 55 but the problem #54 persist. It must come from my configuration.
Thank you very much.

bwynants’s picture

popup does not work because the multiday view uses the id for the references to the nodes while the normal view the class uses

versus

so javascript parsing fails to obtain node id

bwynants’s picture

FileSize
2.93 KB

fix for popup's not working

pfx’s picture

I just tried the patch and the popup works fine now. thank you very much.

bwynants’s picture

FileSize
765 bytes

and a typo in the theme files

arlinsandbulte’s picture

Now that Karen added this to the calendar module, it is no longer a feature request.
Also, I added a MultiDay option to the issue component select list to make this easier to track.

I hope that is OK.

I am tempted to mark this issue as 'fixed' and let further multiday bugs be submitted by in separate issues, but I will let someone else make that call (perhaps after committing #59 & #61 above).

pfx’s picture

Component: Code » MultiDay
Category: feature » bug
FileSize
18.68 KB
18.68 KB

titles "All day" have not line wrapping.
Is this by design.

developer-x’s picture

Yes the all day is not wrapping. This is by design. However, it is all defined in the css - so if you want something different, you can define your own styles.

DaPooch’s picture

Awesome... once this can merge with the AJAXification going on here it would be sheer perfection.
http://drupal.org/node/339279

IsaacJT’s picture

Trying to use this with CiviEvents.

Got Start date & time and End date & time, but they are showing up as separate items (with identical details) on Calendar.

Is there something I'm missing?

Would be really awesome to get this working.

developer-x’s picture

I'm not entirely sure what the error is here - can you include a screenshot? Also, does it work correctly without the patch, then break when the patch is applied?

Shadlington’s picture

FileSize
26.14 KB

Hmmm... A little thing I just noticed when trying this out (the latest dev rather than the patch) was that the recent fix to only have day number link to the day view if there is actually an item for that day stops working when I enabled the multiday module.

Also, the 'Time' column that I see in week view is broken in day view - screenshot attached.

Other than that this is a great enhancement!

IsaacJT’s picture

The theme change applies, but practically speaking there is no change in what's displayed beyond the graphical change when enabling or disabling the module.

It may be my misunderstanding/user error.

I've attached a png. In this example the entry on the 20th is the beginning date of something that lasts until the 29th, where you can see the second entry in calendar. Similarly for the entries on the 12th.

Probably I've got the data formatted wrong (not that I can change CiviCRM's output) or am handling it wrong in Calendar.

All I have from CiviCRM is two dates - a start time and an end time. I use both fields in the default settings for the view, but the two separate dates generate separate entries, rather than connected entries. How do I tell Calendar they are the start & end times for the same event?

izmeez’s picture

subscribing

IsaacJT’s picture

FileSize
21.26 KB

Attachment appears to have failed - retrying. (see above message)

IsaacJT’s picture

FileSize
21.26 KB
IsaacJT’s picture

FileSize
21.26 KB
IsaacJT’s picture

Having trouble attaching.

EDIT: Sorry for multiple posts, my bad. (I think Drupal was undergoing maintenance, but really, I should have just waited) - I don't seem to be able to delete them.

IsaacJT’s picture

FileSize
21.26 KB
developer-x’s picture

Huh - I'm perplexed. If you have an event with a start and end date that span more than one date - it will generate a stripe across those dates. From what I see, it seems that the end date is not being recorded. Can you include a screenshot of your event edit screen? I don't know anything about CiviCRM - but I assume they are using nodes with the date api CCK field? BTW, what is the date type (date, datetime, datestamp) and widget type for your event field?

IsaacJT’s picture

Sorry, you'll need to tell me how to find out the date type/widget type for my event field.

I've included a screenshot of my event edit screen. If I separate out the arguments into separate entries, I end up with just the start date showing on the calendar.

I'm having trouble finding out about CCK. There appears to be work from both the drupal side and from the CiviCRM side to get this to work. But it is unclear whether they have done so for CiviEvents yet or not.

http://drupal.org/node/194628, implies that in 2007 the drupal end had done most things, but not CiviEvents. There are a couple of things attached as offerings of solutions. But nobody seems to have replied recently to that topic however, even though a number of organisations offered small amounts of money.
From the CiviCRM side, the most recent references in the drupal section of their site to cck are dated early 2010 - if those references aren't out of date (they reference .txt files included in the distribution that are their initial attempts), then I'm guessing the answer is no for their end of things.

It's difficult for me to tell though - the fact that lots of people where interested enough in this 2007-2009 to offer money, but nobodies posting more recently suggests that it may have become a non-issue.

IsaacJT’s picture

FileSize
60.79 KB

Reattached screenshot.

developer-x’s picture

Status: Fixed » Needs review
FileSize
262.97 KB
206.03 KB

I think I see the problem. Instead of having a separate "from" and "to" field in your view - you need to have a single "from" date and the format of the output needs to be set to : "Display from and to dates". Also, make sure your date argument matches. Notice in my two screen shots how I have the argument and the "from" field set. Try this and see if it works.

Also, I think we need to close this issue. The patch is now in the dev branch of calendar and issues found in that branch should be a new and separate item. This issue should be for historical purposes at this point. Karen is that correct?

arlinsandbulte’s picture

Status: Needs review » Fixed

I agree with #79. The initial 'issue' is now in -dev, so this should be fixed.

The main problem IsaacJT is running into is the way Civicrm handles dates and date creations.
I have no experience with Civicrm, so I can't be of much help.
In any case, IsaacJT's issue needs to be either as separate date issue (as per #79) or maybe even an issue for Civicrm.

IsaacJT’s picture

Status: Needs review » Fixed

Thankyou for your help. I will open a separate issue as suggested - though Arlinsandbulte may be right that it could be a CiviCRM issue.

Shadlington’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

DaPooch’s picture

Getting the multiday to work is a bit perplexing. I can get it to work on the default display as long as I don't attach one of the month, week, day or year displays to it. On the "Calendar page" display though I can't get it to show up right. I attach a the "month view" display to it so I can get something to show up and when I do that my multiday event shows up as individual boxes on each day instead of a span across all the days. In just previewing the "month view" I get the same result, individual boxes. Am I missing the method for applying the multi-day style to individual attachment views? I'm using the latest dev version of calendar with the separate calendar_multiday module enabled.

EDIT: Nevermind, I missed the correct styling options on the "Month View" display. Changed my calendar style settings multi-day style and it works like a charm now.

DaPooch’s picture

Status: Closed (fixed) » Needs review
arlinsandbulte’s picture

Status: Needs review » Closed (fixed)

This issue as all about getting the first workings of multiday into calendar, which is now complete.
If you are having issues with multiday, do not re-open this issue.
Rather, start a new issue where your problem can be better focused on.

developer-x’s picture

Please refer to #29 - make sure the style settings are set correctly. If you are still having problems, as mentioned in #86, please open a new issue and assign to the MultiDay component.

corvela’s picture

Category: bug » support
Status: Closed (fixed) » Active

Hi, any chance of providing me with a fully patched module?

arlinsandbulte’s picture

Status: Active » Closed (fixed)

corvela:
Please file a new issue and explain what problems you are having there.

corvela’s picture

Status: Closed (fixed) » Active

Sorry, new to this. How do I file an issue?

developer-x’s picture

No worries - we were all new at some point. If you just want to use the multiday functionality and you aren't having a problem - don't create an issue, just download the latest version of the calendar module - it's now a submodule.

arlinsandbulte’s picture

corvela:
No problem. Like dev-x said, just use the latest version of calendar module and enable the multiday submodule.

If you have problems, first do a search in the issue queue to see if your problem has already been reported or fixed.

If you can't find a duplicate or a solution, go ahead and create a new issue by clicking "Create a new issue" (or you can go here: http://drupal.org/node/add/project-issue/calendar)

developer-x’s picture

Status: Active » Closed (fixed)
flock’s picture

Hi, great calendar patch!

Is there any way you can direct me to a step-by-step application of this?, I am new and although this seems very exciting I got lost in the actual steps to take.

Thank you.

developer-x’s picture

This patch is now a sub-module of the calendar module. Simply download the latest calendar or do it from cvs so that you have all the latest changes:

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d calendar -r DRUPAL-6--2 contributions/modules/calendar/

Then enable the multiday submodule. That's it.

binaryflo’s picture

I'll be implementing this in the next couple of days. Thank you for your hard work.

Steel Rat’s picture

Developer-X,

The work you've done on your demo calendar is fantastic!

However, I'm not sure how to get there with what I have. I'm using the latest as of right now release version of Calendar, and enabled the Multiday option. But I don't get the spanned events based on the to and from times. I did copy the tpl files to my theme (Acquia Prosper), even though there were no instructions to do so, but I still don't see the overlapping time spans in the calendar as shown in your demo. It looks pretty much like the vanilla calendar.

I did flush the theme registry after copying the tpl files. Is there someting else I need to do? There were no instructions in the module...

Thanks!