Description

This module enables users to get their CiviCRM assigned activities into their Google Calendar or similar calendaring applications, by providing a feed of each user's assigned activities in iCalendar format, ready to be subscribed to from with Google Calendar, Outlook, etc.

Blog post announcing the module to CiviCRM community (note positive response in comments): http://civicrm.org/blogs/allenshaw/publishing-activities-icalendar-feed

Demo video here: http://nswebsolutions.com/ideas/new-module-drupal-civicrm-activities-ica...

Key features

  • Activities are represented as VEVENT objects, matching applicable properties (DTSTART, DTEND based on duration, etc.) where possible and appending names of any other asignees to the DESCRIPTION property.
  • Feed includes activities of any type, including client-defined activity types.
  • Feed includes activities with a status of "Scheduled" or any client-defined activity status.
  • To conserve server resources, feeds are cached at a site-wide configurable interval (default 30 minutes).
  • A user's Activities feed shows all activities having that user assigned, even if other users are also assigned.
  • The user can easily determine the correct URL for the Activities feed by viewing the URL in CiviCRM.
  • URL includes a persistent random hash to limit other parties' attempts at guessing the URL and viewing the user's feed; this can be re-generated by the user in case, for example, the URL becomes known to the wrong people.

Drupal version

Code is being built for a client's system in Drupal 6, and once accepted by the client will be ported to Drupal 7.

Project page

http://drupal.org/sandbox/TwoMice/1274276

Git repo

git clone --branch 6.x-0.1-dev http://git.drupal.org/sandbox/TwoMice/1274276.git civicrm_activity_ical

Comments

TwoMice’s picture

Note: You'll find Coder turns up one warning about curly braces on table names in SQL. This is something of a false positive, since the query is sent to CiviCRM's DAO framework (which doesn't use the curly braces) and not to Drupal's database API.

TwoMice’s picture

Title: CiviCRM Activities iCalendar Feed » CiviCRM activities iCalendar feed
Priority: Normal » Major

Elevating priority after two weeks of waiting, per project submission guidelines. (And understanding that project review backlog is huge.)

klausi’s picture

Priority: Major » Normal
Status: Needs review » Needs work
  • wrong git branch name: "6.x-0.1-dev" should be "6.x-0.x"
  • "require_once 'functions.php';" does that work? I think PHP will try to locate the file in the Drupal root folder, no?
  • "require_once 'CRM/Utils/ICalendar.php';" CRM? What is this and where is it located?
  • ICal.tpl: you must not add external library files to your repository, see http://drupal.org/node/422996
  • class CivicrmActivityIcalCache: doc block is useless, please add proper information
TwoMice’s picture

Status: Needs work » Needs review

Thanks for the review! I've fixed all the mentioned items and/or explained where appropriate below:

wrong git branch name: "6.x-0.1-dev" should be "6.x-0.x"

Fixed. Correct branch now available here:
git clone --branch 6.x-0.1 http://git.drupal.org/sandbox/TwoMice/1274276.git civicrm_activity_ical

"require_once 'functions.php';" does that work? I think PHP will try to locate the file in the Drupal root folder, no?

Fixed. Now using
require_once drupal_get_path('module', 'civicrm_activity_ical') .'/functions.php';
and using similar code wherever a file is included (except CiviCRM files; see next point).

"require_once 'CRM/Utils/ICalendar.php';" CRM? What is this and where is it located?

These are files from the CiviCRM module, which this module requires. CiviCRM provides its files for inclusion by dynamically adjusting the PHP include path. Because of this it's incorrect to include a CiviCRM file using the full file path.

You raise a good point, though. Most Drupal developers looking at the module code won't assume this unique behavior. To lessen potential confusion, I've added comments to every line that includes a CiviCRM file in this way.

For reference, this CiviCRM manual page explains a little about how this include-path manipulation works:
http://wiki.civicrm.org/confluence/display/CRMDOC40/Directories

ICal.tpl: you must not add external library files to your repository, see http://drupal.org/node/422996

Sorry, my mistake. This is actually not a third-party file. I wrote this file based on a similar file within CiviCRM and mistakenly included the CiviCRM copyright header at the top of this file. I've removed that now.

class CivicrmActivityIcalCache: doc block is useless, please add proper information

Fixed. The doc block now contains a short description of the purpose of the class.

klausi’s picture

Status: Needs review » Needs work
  • branch name should be "6.x-0.x", not "6.x-0.1", see here http://drupal.org/node/1015226
  • I think you should mention the civicrm dependency in the README.txt installation instructions.
  • "'description' => t('Cached data for CiviCRM activity iCalendar feed module')," do not run your DB field descriptions through t(), this will only generate overhead for translators.
  • civicrm_activity_ical_help(): the "break;" statement should be indented one level deeper.
  • "'menu_name' => 'devel',": why are you doing this? Does that require the devel module?
  • "@param $uid The uid of the user": the description of the parameter should be on a new line, see http://drupal.org/node/1354#functions

Otherwise I think this is nearly ready.

TwoMice’s picture

Status: Needs review » Needs work

Hi,

Thanks again for the review. I've fixed the items you mentioned:

branch name should be "6.x-0.x", not "6.x-0.1", see here http://drupal.org/node/1015226

Sorry, my mistake. Thanks for pointing that out. Correct branch now available here:
git clone --branch 6.x-0.x http://git.drupal.org/sandbox/TwoMice/1274276.git civicrm_activity_ical

I think you should mention the civicrm dependency in the README.txt installation instructions.

Okay, this is done.

"'description' => t('Cached data for CiviCRM activity iCalendar feed module')," do not run your DB field descriptions through t(), this will only generate overhead for translators.

Ah, good point. Fixed in all schema descriptions.

civicrm_activity_ical_help(): the "break;" statement should be indented one level deeper.

Fixed.

"'menu_name' => 'devel',": why are you doing this? Does that require the devel module?

No, that's a mistake. Fixed.

"@param $uid The uid of the user": the description of the parameter should be on a new line, see http://drupal.org/node/1354#functions

Fixed, and made other similar improvements to function comment blocks as well.

Thanks again for taking the time to review this.

TwoMice’s picture

Status: Needs work » Needs review
klausi’s picture

Status: Needs work » Reviewed & tested by the community
  • the implementation of hook_enable should be in the .install file
  • "$items['civicrm_activity_ical/feed/%/%']": use "%user" to leverage the loading mechanism of the menu system. So you don't have to load the user yourself.
  • civicrm_activity_ical_get_feed_data(): the SQL query in there really scares me ... I better don't ask what kind of black magic is going on here.
  • "@param int $uid The uid of the given user": the description of the parameter should be on a new line, see http://drupal.org/node/1354#functions

But these are just minor nitpicks, I think this is RTBC. Now while we are waiting for the access grants to create full projects would you be so kind to do a review of the other applications pending? Just pick one from this list: http://drupal.org/project/issues/projectapplications?status=8

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, TwoMice! Welcome to the community of project contributors on drupal.org.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

As you continue to work on your module, keep in minde: Commit messages - providing history and credit and Release naming conventions.

TwoMice’s picture

Thanks for the approval!

Status: Fixed » Closed (fixed)

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