Hi,
i'm trying to use the fullcalendar view with a date field nested inside a field collection.
Apparently, the fullcalendar row style doesn't recognize the date field as it is not a pure date field.
It would be great to have such a feature, to achieve things like what i'm trying to do : i want users to be able to edit their availabilities with a calendar, so i created a simple field collection with a date field and a textfield, so they can set a date with a "available" label, or "unavailable", or "unknown".
So when they edit their account, they get a fullCalendar view with all their dates, and by simply click / dragging they can create dates and switch their availabilites by clicking on the existing dates.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

Status: Active » Postponed

These kind of feauture request will need to wait untill we are done with the x.2 branches.
The 7.2 is almost feauture complete it, and will be prety stable soon.

After that we have to work on the 6.2 branch to port all the changes we made to the 7.2 branch. (if possible)

When that job is done, we can try to add this feauture to the x.2 branches. BUT if it needs a (small) rewrite of the core architecture it has to wait untill there is x.3 release.

Just to let you know why I postpone this issue for now :)

tim.plunkett’s picture

I'm assuming you're talking about http://drupal.org/project/field_collection?
I'd also like to support http://drupal.org/project/micro and http://drupal.org/project/fieldentity and... everything!

Really, *everything* is postponed until #1024586: Field machine names don't respect the field title is in and we support the changes.

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

This is going to be a fun one.
Still blocked, now on #889286: EntityAPIController::load() produces WSoD sometimes with PHP 5.2.

criz’s picture

Would be great if this module is supporting field collections and other entities. Subscribe.

tim.plunkett’s picture

@criz, agreed, but entity module has fatal WSOD on php 5.2 right now, which I'm still using.

pgsengstock’s picture

Status: Active » Postponed

We could really use this feature. It seems to work, except that I get a bunch of undefined index errors for each event. Similar to http://drupal.org/node/1105348.

Here's what is repeated for each calendar entry:

Notice: Undefined index: nid in fullcalendar_prepare_events() (line 172 of /Library/WebServer/site/new/sites/all/modules/fullcalendar/theme/theme.inc).
Notice: Undefined index: nid in fullcalendar_prepare_events() (line 173 of /Library/WebServer/site/new/sites/all/modules/fullcalendar/theme/theme.inc).
Notice: Undefined index: entity keys in entity_extract_ids() (line 7399 of /Library/WebServer/site/new/includes/common.inc).
Notice: Undefined index: entity keys in entity_extract_ids() (line 7400 of /Library/WebServer/site/new/includes/common.inc).
Notice: Undefined index: entity keys in entity_extract_ids() (line 7399 of /Library/WebServer/site/new/includes/common.inc).
Notice: Undefined index: entity keys in entity_extract_ids() (line 7400 of /Library/WebServer/site/new/includes/common.inc).
tim.plunkett’s picture

Status: Postponed » Active

Okay, I'm going to unpostpone this and try working on it soon.

tim.plunkett’s picture

Status: Postponed » Active

As I summed it up in IRC:

each event is a node. and the node contains field_collections, which contain date fields. fullcalendar is treating the node as the parent, because thats how every other entity works. but in this case, its the grandparent

tim.plunkett’s picture

Title: Recognize date field inside field collection » Recognize date fields from entities that are not the same as the view's base type
Category: feature » bug
Priority: Normal » Major
Issue tags: +D7 stable release blocker

This is actually not field_collection specific.

If you have a date field attached to your user, say their birthday, you could build a view of nodes, and create a relationship to the author, and display the nodes by their birthday. (If anyone has a more plausible usecase, let me know.)

The problem is that fullcalendar will check for a node entity, not the user entity.

This is fixable, except when you display two date fields, each from separate entities. Currently the code only accounts for one entity, it obviously cannot do that.

Instead of having one entity object, we can have an entities array with keys of the base table and all relationship ids, and store the key with the field, checking as we go.

Patch to com, but it's new years this weekend so maybe not til next week.

tim.plunkett’s picture

Wow, that was actually a lot of fun to fix.

I built out a view that displays node dates, the author's dates, and fullcalendar dates, all at once, and it works fine.

Attached is the actual patch, and then just a function non-whitespace diff that includes the relevant parts to make it easer to review since it includes a bunch of indenting/outdenting.

tim.plunkett’s picture

Status: Active » Needs review
FileSize
2.13 KB

Er, I meant to upload this one as the easy-to-see-real-changes patch.

aspilicious’s picture

Tested this with fieldgroup and it works great.

I do found a small coloring problem with fieldgroups. They don't get colored correctly.
It's also a bit different with the field being an entity and stuff.

Fieldgroups should also be a seperate tab and not part of coloring nodes. That's confusing :).
Maybe that is part of this bug, because that would mean that

$entity->entity_type always equals 'node' else the classes don't get added...

aspilicious’s picture

Mèèèh, aparantly field groups are nodes. I still think we should special case that in the colors module and give fieldgroup a special tab. That tab can be under node or it can be a primary tab.

Anyway I fixed the color thingie, it was a bug in fullcalendar. Search for drupal_html_id() in the patch.
Thnx to chx who proposed the function after I explained the problem.

ps: problem was mixed underscores and dashes in class names and ctools colors always uses dashes.

tim.plunkett’s picture

Sure we can add another plugin to colors. I'll add in this class name fix as part of this issue, but I'll do it as a separate commit.

Otherwise this is rtbc?

aspilicious’s picture

Yes sir :)

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Status: Needs review » Fixed

Actually, I'm going to commit this as is from #10, I'm not 100% on board with calling drupal_html_id twice like that, we can discuss it in another issue, especially since it's unrelated to this fix.

http://drupalcode.org/project/fullcalendar.git/commit/936ad6e3294f9c124b...
http://drupalcode.org/project/fullcalendar.git/commit/d245abed6bda4ffd9a...
http://drupalcode.org/project/fullcalendar.git/commit/8393d3ec03088aa96e...
http://drupalcode.org/project/fullcalendar.git/commit/978e22e8464b176c97...

Status: Fixed » Closed (fixed)
Issue tags: -D7 stable release blocker

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