Comments

jwhat’s picture

This would be interesting. We could parse an xml (or with more work, an ical file) and then add those events to the JS that renders the events in fullcalendar.

For reference, here's Google's US Holidays XML file: http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.c...

tim.plunkett’s picture

jwhat’s picture

Let's get #980886: Require Libraries API resolved first, so that we don't have to worry about adding this gcal.js file.

tim.plunkett’s picture

Status: Active » Postponed
tim.plunkett’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Postponed » Active

Trying to get a 6.x-1.0 release, new features can wait.

webankit’s picture

will be nice feature for 7.x too subscribing

aspilicious’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
StatusFileSize
new3.58 KB

Pushing to D7, cause I wrote this for that branch.

Initial patch, couple of todo's (ctrl-f them).
Used http://arshaw.com/fullcalendar/docs/google_calendar/ as a reference.

Btw: edit the admin path so it show up on the configuration screen. (forgot to include it in the patch)

tim.plunkett’s picture

Status: Active » Needs work
aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new4.45 KB

Ok It's alrdy working (for D7), just had to figure some things out.
Learned a lot by doing the wrong stuff :).
I'm prety sure this can be comitted to a dev branch. Port to D6 should be easy :)

There are still some todo's but it is working for everyone desperate to try this out.
You can define your own class and feed in the admin menu for easy styling.
The edit function isn't working yet (small bug I guess) ==> Please help me :p

Multiple google feeds aren't allowed yet, we should figure out first how to handle that in the admin menu (as each calendar should have its own class name)

Screenshot admin:
http://awesomescreenshot.com/04c6761e2

Screenshot calendar with google events: (red squares are google calendars :D)
http://awesomescreenshot.com/060676440

aspilicious’s picture

StatusFileSize
new4.48 KB

Now without tabs or trailing whitespaces... I hope...

aspilicious’s picture

Status: Needs review » Needs work

Needs work, cause when you don't insert a gcal xml file you're screwed :p :) (you don't see any dates)

EDIT:

This code makes at least the drag and drop functional again, the gcalFeed function goes mad when you enter an empty string as feed url. And stupid javascript wont allow me to add an if test in the construction ;)

Fix this and eveything works... I hope...

    eventSources: [ 
      $.fullCalendar.gcalFeed(
        Drupal.settings.fullcalendar.gcal_feed_url,
        {
          className: 'fc-event-default ' + Drupal.settings.fullcalendar.gcal_class_name,
          editable:  (Drupal.settings.fullcalendar.gcal_editable == 'true') ? true : false,
        }
      )
     ]
aspilicious’s picture

Depends somewhat on this feature request we made:

http://code.google.com/p/fullcalendar/issues/detail?id=803&colspec=ID%20...

tim.plunkett’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs work » Postponed

Can't wait to work on this more.
Waiting to hear back from Adam Shaw.

tim.plunkett’s picture

StatusFileSize
new4.08 KB

This is a stop-gap for people dying for this feature.
It means all calendars will have the events of this one Google Calendar.
Add it here: admin/config/calendar/fullcalendar
Be sure to change the hardcoded timezone in fullcalendar.views.js to match the Google Calendar timezone.

aspilicious’s picture

Status: Postponed » Active
StatusFileSize
new2.18 KB

I'm making this active again on drupal dev days, xjolanx007 (a friend of mine) said he was going to convert the gcal function. And here is the result. A brand new gcal.js file. I think it will take a while before this will be integrated into the fullcalendar plugin So I suggest to:

1) create a submodule for the gcal integration (as it is not rly a feature everyone needs).
2) add the new gcal.js feed to that directory.
3) create the views integration in that module.

Good idea?

- I decided to rename the function to gcalFeedArray(), don't forget that while testing.
- I know Tim would like to program this himself AND we need to agree about the workflow for this.
So I'm not asigning this to myself.

Have fun!

BTW: if we ever commit this don't forget to give xjolanx007 some credits ;)

aspilicious’s picture

This how the array should be build:

[
[
"http://www.google.com/your_feed_url/",
{
// put your options here
className: 'gcal-event',
editable: true,
currentTimezone: 'America/Chicago'
}
],
[
"http://www.google.com/your_feed_url2/",
{
// put your options here
className: 'gcal-event',
editable: false,
currentTimezone: 'America/Chicago'
}
],
]

aspilicious’s picture

StatusFileSize
new2.45 KB

Now without tabs...

aspilicious’s picture

StatusFileSize
new2.28 KB

This one can handle empty arrays...

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new4.9 KB

This gets the feeds into the format described in #16, available in Drupal.settings.fullcalendar.gcal.

aspilicious’s picture

StatusFileSize
new9.43 KB

Ok this should do it...

aspilicious’s picture

StatusFileSize
new9.45 KB

Without tabs this time?

tim.plunkett’s picture

Status: Needs review » Needs work
StatusFileSize
new7.69 KB

Cleaned up the patch a bit more, to reduce the changes made.
#21: 6 files changed, 197 insertions(+), 24 deletions(-)
#22: 6 files changed, 170 insertions(+), 1 deletion (-)
The indentation is all out of whack anyway, we can fix that later.

The manual array stuff in the new gcal.js is strange to me, why doesn't it use .each()?

If you have a calendar with node-based events, it works.
If you have node-based and GCal-based events, it works.
But if you have node-based events, and you enter a GCal feed that doesn't work, all events silently fail to display.
I noticed it first with a typo, and once when my wi-fi was turned off.
Any thoughts?

aspilicious’s picture

1) The array stuff, probably because we are used to java and c++. No special reason.

2) That's because json(p) silently fails, so the callback doesn't get called so there are no events. The original script has the same problem.

JSONP is a very powerful technique for building mashups, but, unfortunately, it is not a cure-all for all of your cross-domain communication needs. It has some drawbacks that must be taken into serious consideration before committing development resources. First and foremost, there is no error handling for JSONP calls. If the dynamic script insertion works, you get called; if not, nothing happens. It just fails silently. For example, you are not able to catch a 404 error from the server. Nor can you cancel or restart the request. You can, however, timeout after waiting a reasonable amount of time. (Future jQuery versions may have an abort feature for JSONP requests.)

aspilicious’s picture

StatusFileSize
new7.79 KB

1) switched to the each function, prety nice :)
2) fixed the tabs

aspilicious’s picture

Status: Needs work » Needs review

Needs review cause there is no clean solution for the jsonp calls (without making asumptions about timeouts).

aspilicious’s picture

StatusFileSize
new8.02 KB

Ok final patch?
Now based on: #1049080: Support non-Field API fields and relationships

- google calendar stuf is a field and it works :)
- you can edit the classnames for easy theming
- it gets accepted as a date field (only 1 line fix OW YEAH, thnx to the patch dependency)
- you can select this field as a custom date field. (we are so lucky it works out of the box due to our architecture :) )
(and yes it will not use all the other date fields if there are any)

tim.plunkett’s picture

Status: Needs review » Fixed
tim.plunkett’s picture

aspilicious’s picture

Status: Active » Needs review
StatusFileSize
new6.28 KB

Now the fix without the hack :)

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

Code looks good, will test soon.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Status: Needs review » Reviewed & tested by the community

Great. Will commit tomorrow morning, it's Valentine's Day here in the US.

aspilicious’s picture

Status: Reviewed & tested by the community » Needs work

You can disable the colorbox for gcal events with the folowing code.

from

  if (settings.colorbox) {

to

          // Open events in colorbox when:
          // - we turned on the colorbox setting	
          // AND
          // - the id is undefined. This allows us to filter out gcal events because they have an id. 
          if (settings.colorbox && (calEvent.id === undefined)) {

I can't patch this at the moment because git fetching is blocked at the university...

aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new6.99 KB

Needs review

aspilicious’s picture

StatusFileSize
new6.73 KB

New one

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new7.35 KB

I'm going to commit this, but with comment and whitespace fixes. Here's the final version.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

tim.plunkett’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Closed (fixed) » Patch (to be ported)

Yeah...

izmeez’s picture

subscribing

miwsio’s picture

Will it be backported for Drupal 6 ?

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Category: feature » task

This is next.

tim.plunkett’s picture

Priority: Normal » Major
tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Status: Patch (to be ported) » Needs review
StatusFileSize
new7.53 KB

This should be good.

aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

Seems to do the job :).

Test cases:
- add gcal calendar on normal event calendar
- add empty gcal calendar to new calendar
- filled the calendar with one event but didn't make the calendar public
- same as before but made it public

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

dboulet’s picture

Looks like the commit in #45 made this module incompatible with Views 2, was that on purpose?

tim.plunkett’s picture

As stated on the project page and in the README, the 6.x-2.x branch was always only for Views3, this patch just happened to update the hook_views_api() function accordingly.

dboulet’s picture

I see it now, thanks Tim.