I use FullCalendar with Date iCal to pull in and display several ical feeds from Google. They all stopped working this morning around 11:30 EST. Apparently, Google has disabled V2 of the Calendar API.

See https://developers.google.com/google-apps/calendar/v2/developers_guide_p...

Not sure if this is a FullCalendar issue, or Date iCal issue? Is there a quick fix, or should I find another way to display my calendars?

Thanks -

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Well that sucks.
This isn't handled directly by the module, but by the FullCalendar library upstream.

glidetothehoop’s picture

Can this be fixed by using the newer 2.2 version of FullCalendar libraries?

webiator GmbH’s picture

@glidetothehoop

I tried simply replacing the fullcalendar library with the latest version: no effect

Alienpruts’s picture

OK, looking good.. not :)

As far as I can tell, we need v 1.6.5 of the library (which has an updated Gcal.js to use the V3 of the API). You can find it at https://github.com/arshaw/fullcalendar/releases/tag/v1.6.5

Then the real fun starts... According to what I've read at https://code.google.com/p/fullcalendar/issues/detail?id=1526 we'll be needing an API key from Google to be able to use our calendar . Oh joy...

I'm in the process of testing things out ATM, in the limited time I have available today. I just thought I would post this quick notice so that others might take a stab at making this work.

I'm inclined to change the status of this issue to Support, because this clearly isn't a bug in the module (yet) :) We would benefit more from a quick note in the project overview page describing what has happened and (hopefully) how to fix this.

Will be in touch

Alienpruts’s picture

OK, i'm out of time to work on this.

I haven't been able to get this to work (yet), but I think there will need to be some changes in this module as well.

I think we will need to have a way to pass the API key to the fullcalendar library. I'm thinking about adding an option to the Fullcalendar : Google Calendar field in Views , but I'm not sure this would be enough to get this working again... I'll look into it when I have the time

EDIT :

More info about this issue at http://fullcalendar.io/docs/google_calendar/

barbbar’s picture

Thanks Alienpruts for looking at this! FYI - this is also impacting the Agenda module (https://www.drupal.org/node/2376795) - sounds like the folks there are struggling with the same API questions. Too bad - the combination of Agenda and FullCalendar made a great solution for some folks who have 10+ Google Calendars they want to show on their website as a consolidated calendar/list.

Alienpruts’s picture

Assigned: Unassigned » Alienpruts

Patch on the way, I've had some success

Alienpruts’s picture

Patch time :)

My use case :

I have one calendar which is shown on the website, worked fine before 17/11.

Issue was indeed the shutdown of V2 of the Google API.

Attached patch does this : adds two fields to the Fullcalendar : Google Calendar field handler (googleCalendarApiKey and googleCalendarId. These values are then passed on the the gcal.js library.

YOU NEED minimum vs 1.6.5 of this library for this patch to work!

You ALSO need to login to Google Developers, create a new project, set Google Calendar API, and under authorization (don't know the exact term, I'm typing this out of my head) , you can request an API key and set the website (host) which should have access to this calendar.

You'll also need the Google Calendar ID, this can be found by going to your Calendar Settings, under Calendar Settings, where you used to find the Feed URL.

As I said, in my case it works, but your case may vary. If so, drop me a line, I might be able to take a look and help out with the maintainers.

Good luck :)

Alienpruts’s picture

Status: Active » Needs review
FileSize
476.97 KB

Added a screenshot of a working Calendar

webiator GmbH’s picture

Thank you! going to try it asap!

hallswah’s picture

Sorry for sounding ignorant but how do I apply that patch ?

tacoberly’s picture

I applied the patch and I have the API key and Calender ID. I'm not sure where to add the API key and Calendar ID? I'll keep looking but would greatly appreciate any help! Thanks much.

mbaynton’s picture

The process for configuring your API key is (from https://developers.google.com/google-apps/calendar/firstapp):

Go to the Google Developers Console.
Select a project, or create a new one.
In the sidebar on the left, expand APIs & auth. Next, click APIs. In the list of APIs, make sure the status is ON for the Google Calendar API.
In the sidebar on the left, select Credentials.

You want to create a "Public API access" credential, with allowed referers set to *.yoursite.com. The API Key that Google will spit out at you goes into Alienprut's new UI. Edit the view associated to your calendar in Views UI, and click on the "FullCalendar: Google Calendar" field to bring up the form where you enter the API Key.

The Calendar ID was a little tricky to find for me, it's in the Calendar Address section of "Calendar Details" tab of the google calendar settings, not the "Share this Calendar" tab.

mbaynton’s picture

Up & running, but I had the event descriptions appearing as popups when mousing over an event. Looking at the v3 jsonp, it's not even in there anymore. Anyone else noticing this feature's missing?

Alienpruts’s picture

@hallswah, see https://www.drupal.org/patch/apply for more info about that.

@mbaynton : thanks for writing the litlle documentation, I didn't have time left to properly explain myself.

Not sure about your other question though, I'm guessing this should be in another issue?

Maybe the maintainers can shed some light on that particular issue?

Alienpruts’s picture

Assigned: Alienpruts » Unassigned
Jean Gionet’s picture

is this patch applied to the current stable version of this module?
edit: nm I noticed the version at the top of this post :)

I was able to patch the file and d/l 1.6.5 of FullCalendar.
I entered my API key and Calendar ID. (the API is on)
I'm still not seeing anything. I do have multiple calendars, however I did specify the calendarID and API key on each calendar I created in Views.

any ideas?

Alienpruts’s picture

No, all patches should go in the dev branch of a module, which I did. However, I tested the patch on my production server yesterday, worked fine with latest stable branch.

Jean Gionet’s picture

I'll test it out on the DEV branch to see if that makes a diff

edit: same results. All my calendars are still blank. No errors messages displayed.

Recent log messages shows this:

Location http://************/admin/structure/views/ajax/config-item/calendar/page_1/field/gcal
Referrer	http://************/admin/structure/views/view/calendar/edit/page_1
Message	Notice: Undefined index: element_wrapper_class_enable in views_handler_field->options_submit() (line 462 of /home/gionet/************/sites/all/modules/views/handlers/views_handler_field.inc).
Location	http://************/admin/structure/views/ajax/config-item/calendar/page_1/field/gcal
Referrer	http://************/admin/structure/views/view/calendar/edit/page_1
Message	Notice: Undefined index: element_label_class_enable in views_handler_field->options_submit() (line 462 of /home/gionet/************/sites/all/modules/views/handlers/views_handler_field.inc).
Location	http://************/admin/structure/views/ajax/config-item/calendar/page_1/field/gcal
Referrer	http://************/admin/structure/views/view/calendar/edit/page_1
Message	Notice: Undefined index: element_class_enable in views_handler_field->options_submit() (line 462 of /home/gionet/************/sites/all/modules/views/handlers/views_handler_field.inc).
Location	http://************/admin/structure/views/ajax/config-item/calendar/page_1/field/gcal
Referrer	http://************/admin/structure/views/view/calendar/edit/page_1
Message	Notice: Undefined index: element_wrapper_type_enable in views_handler_field->options_submit() (line 456 of /home/gionet/************/sites/all/modules/views/handlers/views_handler_field.inc).
Location	http://************/admin/structure/views/ajax/config-item/calendar/page_1/field/gcal
Referrer	http://************/admin/structure/views/view/calendar/edit/page_1
Message	Notice: Undefined index: element_label_type_enable in views_handler_field->options_submit() (line 456 of /home/gionet/************/sites/all/modules/views/handlers/views_handler_field.inc).
Location	http://************/admin/structure/views/ajax/config-item/calendar/page_1/field/gcal
Referrer	http://************/admin/structure/views/view/calendar/edit/page_1
Message	Notice: Undefined index: element_type_enable in views_handler_field->options_submit() (line 456 of /home/gionet/************/sites/all/modules/views/handlers/views_handler_field.inc).
Alienpruts’s picture

That seems to be more of a error in the specific view than with the module, by the looks of me. However, during my research yesterday I found that multiple calendars are 'buggy' (to say the least) since the V3 switch.

Pro tip : If you have a debugger for JS (or dev tools) which allows you to set breakpoints in the gcal.js during a page load, try setting a breakpoint after the var url and var key, to see if the APIkey and the google calendar ID is loaded (that's how I managed to fix it).

My guess is that multiple calendar's will require multiple API keys and Calendar ID's, but don't quote me on that :)

EDIT : do you have a url for the site you're trying to debug? I could assist in the debug of the gcal.js when I find tht time

Jean Gionet’s picture

Thanks for the tip!

I sent you private msg with URLs to my calendars.

thanks again

E Johnson’s picture

Patch #8 and the thorough explanation in #13 fixed the Google Calendar issues for me. Thanks a lot Alienpruts and mbaynton.

brody1962’s picture

First, thanks to all helping to fix this issue. I am using the valid Google API Key and a valid Calendar Id (know that because ma agenda module is working again). Furthermore I applied the patch to the dev version of the module (under Linux), but the fullcalendar on my homepage remains empty. Looking at the patched fullcalendar_handler_field_gcal.inc the render function looks strange to me:

function render($values) {
    return array(
      $this->options['gcal'],
      array(
        'editable' => FALSE,
        'className' => $this->options['class'],
        'currentTimezone' => $this->options['timezone'],
        'googleCalendarApiKey' => $this->options['googleCalendarApiKey'],
        'googleCalendarId' => $this->options['googleCalendarId'],
      ),
    );
  }

The lines containing $this->options['gcal'] have all been removed, except here, and I have an array within the return array, which of course is valid PHP, but still somehow strange. Has anybody advice, what went wrong or maybe can supply a download link to a correctly patched fullcalendar_handler_field_gcal.inc?

Alienpruts’s picture

Hello brody1962,

I'm not sure what you mean by 'the lines containing $this->options['gcal'] have all been removed'.

My patch just added the API key field and the Google Calendar ID field to the field_handler, to be able to input those field to the views plugin. Herein lies the answer : the plugin is called 'gcal' and the code for that can be found in fullcalendar.views.inc

.....

'gcal' => array(
      'title' => t('Google Calendar'),
      'help' => t('Display events from a Google Calendar.'),
      'field' => array(
        'handler' => 'fullcalendar_handler_field_gcal',
      ),

......

Furthermore : (and i had to search for this for some time) : for options for this handler to be passed on to the JS library this code is used in fullcalendar.fullcalendar.inc :

....

/**
 * Implements hook_fullcalendar_options_process().
 */
function fullcalendar_fullcalendar_options_process(&$variables, &$settings) {
  $view = &$variables['view'];

  static $fc_dom_id = 1;
  if (empty($view->dom_id)) {
    $view->dom_id = 'fc-' . $fc_dom_id++;
  }

  $options = $view->style_plugin->options;

  $options['gcal'] = array();
  foreach ($view->field as $field) {
    if ($field->field == 'gcal') {
      $options['gcal'][] = $field->render(array());
    }
  }

....

So that is the reason why the $this->options['gcal'] line is still there.. without it, the data in those new fields would never be passed to the gcal.js file.

It seemed the best possible solution at the time (remember, I too had to fix this for one of our projects), but as always, I'm open to final solutions :)

As to why it doesn't work in your specific case : if you can debug Javascript (most developer addons for firefox and chrome have that ability), you can set breakpoints just before and after the variables get loaded. In the gcal script, they try to load the API key and an url containing the google Calendar ID. If those values do get pulled in , but you cannot see your calendar, this *most* likely means your API key / auth is not configured correctly, as far as I can tell.

You did put the API key and ID in the new field provided by the patch, did you ? :)

brody1962’s picture

Thanks for your reply. Yes I have put in the key and the ID, by the way I am using v1.6.5 of the library. When I use the patched file "as is" I get the following message which occurs on line 61:

Notice: Undefined index: gcal in fullcalendar_handler_field_gcal->render()

This notice repeats more than 20 times, I didn't count it exactly, but that will most likely match the number of events to display.

Therefore I thought the row in the render function is surplus.

I have now checked if gcal.js loads the correct values (I'm not too familiar with those JS debuggers, therefore I did simple JS debugging by adding four alerts). The first alert returns that the url is undefined, the second returns the url (replaced the real adress with xxx):

https://www.googleapis.com/calendar/v3/calendars/xxx@gmail.com/events?ca...?

The third alert returns the API key to be undefined, the fourth returns the valid API key exactly as I put it into the module setup. So, I'm really stuck.

glidetothehoop’s picture

Question...in Google Developer...when I choose to create a Public API Access key it then prompts me for "Server Key" , "Browser Key", etc. Which do I choose?

Alienpruts’s picture

@glidetotheloop

you need to select the Browser key, if you plan to show the calendar via a Browser :)

@brody1962 :

I hope you also selecte Browser key? :)

as I said, since the values are beeing passed down to the gcal.js file, I truly believe it isn't the "fault" of the patched module, since it does it job. I am however stumped that the Agenda module (as I recall that's what you have been using) does work...Does it use the same API key?

brody1962’s picture

@alienpruts:
I am using a server key for the Agenda module and there I had to specify an IP adress (the website host), which is allowed to access the Google calendar. Tried of course to use the same here.

But now I'm slowly getting an idea of the differences: Agenda module doesn't access the Google calendar through any JS scripts, I just had a look at the files there. It's all done with PHP (server-side). Here we have the gcal.js script and it's done browser-side, right?

So - I'm not the owner of the calendar - tomorrow at work I will have the owner define a browser key (which will not need specific IP adresses, I guess) and give it another try. Thanks so far, I'll post the result tomorrow.

Alienpruts’s picture

Indeed, well spotted. *stomps his head he didn't think of this earlier* :)

@Jean Gionet

Could this be the solution to your problem?

brody1962’s picture

@Alienpruts: Many thanks for your support, especially as this is not a Google user forum. Using the browser key solved the problem, my events are back in the calendar.

However, I have to turn off the error reporting in Drupal (as usual on a live website), otherwise I get a bunch of 'undefined index' notices as mentioned before. Couldn't figure out where this results from. Will try to investigate on that on my production site.

glidetothehoop’s picture

When I try and apply the patch mentioned in #8 I get the following:

the command I issued (from within the FullCalendar module folder) was

git apply -v google_calendars_are-2376855-8.patch

Here's what I got in response

Checking patch sites/all/modules/contrib/fullcalendar/includes/views/handlers/fullcalendar_handler_field_gcal.inc...
error: sites/all/modules/contrib/fullcalendar/includes/views/handlers/fullcalendar_handler_field_gcal.inc: No such file or directory

I'm new to applying patches. I know the file mentioned in the error message does not exist.
I'm applying the patch to FullCalendar 7.x-2.0 module.

Based on the command line response, did the patch get applied?
Is this error a problem? Any help you can provide for me would be appreciated.
I've got the Google API Key, etc. I just needed to apply the patch to FullCalendar module so I can enter the API key, etc.
I've already copied the 1.6.5 FullCalendar library in place of the older version I was using (1.6.4).

My calendar that I'm working with on my website is located at http://darbycreek.org/calendar/monthly

EDIT: I found the file the error was referring to...here's the folder it was found in

.../sites/all/modules/fullcalendar/includes/views/handlers

Know that I know this, how can I successfully apply the patch?

Thank you,
Greg

glidetothehoop’s picture

Ok, I figured out how to get the patch applied. I put the patch in the same folder as the file being patch and issued ...

patch < google_calendars_are-2376855-8.patch

glidetothehoop’s picture

Does anyone have this working with a google calendar account that has more than 1 calendar associated with it?

glidetothehoop’s picture

Ok, I got my calendar showing.

For me, after applying the patch #8 and following the steps in #13 it would not work UNTIL I played around the the "Allowed Referers" in the Google Developers Console for my API key.

At first I just had *.darbycreek.org
However it was not until I had darbycreek.org/* entered as a referer for my API key did my events show up in the FullCalendar view.

I thought I'd pass that along. I do have more than one calendar associated with my Calendar ID, HOWEVER, only one of them is a Public calendar and that is the one I'm showing in my FullCalendar view.

Greg.

Alienpruts’s picture

Hello Greg,

you should always try to apply your patches with git apply from the root of your project. So you have to download the patch, put it in the main folder of the project and from within that root do git apply patch_name.

Git should know the location of the file by looking at the patch. Do you put your modules in seperate folders contrib / custom? It is the standard now to put downloaded modules in your sites/all/modules/contrib folder and your custom modules in sites/all/modules/custom folder.

Alienpruts’s picture

Status: Needs review » Reviewed & tested by the community

Setting this to RBTC, all users of this patch have reported succes (some with more difficulty than others, granted :) )

junkbox’s picture

worked for me. I manually applied the patch (just so I could see what was changing) but nonetheless it worked great, thanks with the current version of the fullcalendar library.

MrPeanut’s picture

I am trying to set this up as a new calendar (not fix an existing calendar).

I've successfully patched the module and am using FullCalendar 1.6.5. I created the Public API via Google Developer Console. The allowed referer is sub.mydomain.com/*.

I am displaying the calendar with a very simple view — content with just one field (FullCalendar: Google Calendar). The calendar ID is myemail@gmail.com and the API key is the browser key that I generated.

I think that's everything, but the calendar is still blank. Tried flushing caches, etc., but have still not had any luck. The one error I get in the console is:

Google Calendar API: Not Found Object {domain: "global", reason: "notFound", message: "Not Found"}

Alienpruts’s picture

Hello MrPeanut,

this error message is too vague for me to be able to help you, but I assume you have put the Calendar API and Google Calendar ID in the fields supplied by my patch?

Do you have a link where I can go test this specific problem? Perhaps I could give you some more clues by reviewing the console.

MrPeanut’s picture

@Alienpruts — Yes, I entered the API and ID in the fields supplied by your patch. Unfortunately, the site is not available to the public right now. However, let me see about reproducing it on a public site and I could have you look then.

Perhaps this is ignorance, but I'm beginning to wonder (from #34) if it's because my calendar is not public. I was trying to use a private calendar (but still did the public API key, etc.).

Alienpruts’s picture

Hello MrPeanut,

I think you've answered your own question : it stands to reason that your calendar needs to be made public for it to be able to be shown. Let us know how it went :)

eswiderski’s picture

Confirmed #8 & #13 on dev worked for me.

cfmarr’s picture

If you are also using the Agenda module on your site, make sure you generate a separate Google API key for use with Full Calendar. When generating a new key Google will give you options to create a Server, Browser, Android or iOS key. Make sure you create a Browser key when applying this fix to Full Calendar. I tried using the same key I generated for the Agenda fix and I could not get it to work. I later realized it was a Server key.

tenken’s picture

Does this patch work for multiple Google Calendars embedded within 1 Fullcalendar (Drupal) View?

izmeez’s picture

Is this patch going to be committed?

chriscalip’s picture

Re-rolled patch #8 and make it compliant with https://www.drupal.org/patch/apply
fixing git diff based from /sites/all/modules/contrib/fullcalendar/

chriscalip’s picture

Status: Reviewed & tested by the community » Needs work

Current State of Issue Report.

Both patches #8 and #46 needs work and does NOT currently work.
file : js/fullcalendar.fullcalendar.js needs to be updated from gcal feed based (google api calendar v2) to google api calendar v3

Edit:

@file fullcalendar.library.js
$('.fullcalendar:not(.fc-processed)', this.$calendar).addClass('fc-processed').fullCalendar(this.$options);

The problem is this.$options DOES NOT contain the crucial googleCalendarApiKey and googleCalendarId.

chriscalip’s picture

Update on this:

Both patch #8 and #46 did a roughly (@see figure a.) amount of small changes.. which adds additional form items to the row field.
This approach needs to be tweaked because this is a google calendar api v2 based approach.. and yes those feed urls are still available
to the public.. but given the circumstance probably wont be available soon.
Current approach is full calendar row values accepts the feed url, during page render library fullcalendar.js constructor gets some argument information but not the row values (feed url,apikey,calendar id).
jquery library fullcalendar.js (1.6.5+ & < 2) based Google Calendar api v3 constructor needs to have {events{googleCalendarId,googleCalendarApiKey}}
as an argument.

figure a. 1 files changed, 13 insertions, 4 deletions.

Alienpruts’s picture

Tnx, chriscalip,

I can confirm that with those patches the google Calenders do NOT work anymore.

If I understand you correctly the fullcalendar.js file needs a patch?

chriscalip’s picture

A few files needs patching.. was working with drupal 6 version fix https://www.drupal.org/node/2467677 and it should work.. but just found out the bad news that drupal 6 version is not possible with the current jquery.fullcalender google api v3 because of jquery versions.

My work with scrapped d6 version upgrade should work with drupal 7 version.. yeah ill port now that code to d7

chriscalip’s picture

First working version capable of doing multiple sources and working with google calendar api v3.

chriscalip’s picture

bugfix on patch; check both api key and calendar before adding as an eventsource.

chriscalip’s picture

On my local site. I am able to make use of multiple event sources with a corresponding api key for each source. On my install there is css problem .. as I am not able to see the events without modifying the css.. In other words the events are loading up (you can hover on the events or see in the console) in the calendar but its current rendered invis because of css.

Alienpruts’s picture

Hello chriscalip,

I've tried applying your patch, but it failed to do so. Quick question : did you create your patch on top of my patch at #8?

If so, you should reroll the patch vs the dev version of the module instead of against my patch.

If not, my bad. I'll look further then :)

Tnx

BDuell’s picture

This patch didn't apply correctly for me on 7.x-2.0+7-dev either. Specifically, I was missing the googleCalendarApiKey and googleCalendarId assignments in the render function of fullcalendar_handler_field_gcal.inc

Attached is my working diff of 7.x-2.0+7-dev

Please let me know of any questions or concerns (and thanks for everyone's work on this).

eawheeler’s picture

I'm successfully feeding Google Calendars as well. Here's my solution.

  1. Install version 7.x-2.x-dev
  2. Apply patch in post # 55
  3. Obtain a browser API key following post # 13
  4. Add a FullCalendar: Google Calendar field to a view and add the following information specific to your calendar: Feed URL, Google Calendar ID, Google Calendar API Key
fotograafinge’s picture

I did the same as #56, but no google calendar is showing. Maybe because i'm testing on my MAMP? Or doesn't that affect the API key?

I don't get any errors.

fotograafinge’s picture

I tried it again today, but it still doesn't show anything. Not in the dev version 7.x-2.x-dev (with dev patch), not in 7.x-2.0 (with 2.0 patch).

I got it working with the Agenda module, but that only displays blocks and I really need the month overview from Fullcalendar. But now I'm sure my Google Calendar ID and Google Calendar API Key are correct.

But when I was fetching the xml feed-URL from Google Calendar, I got this message from Google: NOTICE : As of November 18, 2015 XML feeds from Google Calendar are no longer available
So I guess the module won't be working after Nov 18th ?? Is the feed URL really necessary because the agenda module doesn't need it.

Alienpruts’s picture

Hello fotograafinge,

I myself, as a patcher to this module, am no longer using it, especially because of the notice you described.

I think you should investigate other options for displaying a Calendar on your Drupal site, even using the library itself could prove useful in the long run.

I have no idea if this module can be used after Nov 18th, I haven't heard from the maintainer(s) ever since the issue for which this patch was created arose.

Good luck,

tim.plunkett’s picture

I'm willing and ready to commit a fix once one is found, but I don't have time to work on it myself.

izmeez’s picture

@BDuell Did you change the patch uploaded in comment 55 ? The chronology of comments no longer follow a sequence making it hard to follow what is going on.