Commit 6ba016bf authored by Robert Rollins's avatar Robert Rollins

Final commit for Date iCal 7.x-2.0.

Includes patches from issues 1895396 and 1462646.
Updated the README and the CHANGELOG.
parent d41545dd
Date iCal 7.x
=================
===================
===================
Version 7.x-1.x-dev
Version 7.x-2.0
===================
- Issue #1721678, incorporate abandoned Parser iCal module's Feeds plugin, allowing Date iCal to parse iCal feeds.
- Issue #1833362, convert to using the iCalcreator library, rather than the theme system, for formatting iCal data.
- Many other issues, which were closed during the week of Jan 14, 2013.
===================
Version 7.x-1.2
===================
- Issue #1793868, fix error when adding iCal view mode to non-standard entities.
- Issue #1863448, Remove extraneous div around the feed icon.
- Issue #1721678, incorporate abandoned Parser iCal module's Feeds plugin, allowing Date iCal to parse iCal feeds.
- Many other issues, which were closed during the week of Jan 14, 2013.
===================
Version 7.x-1.1
......
Date iCal Module
Date iCal
Roadmap and Background:
This module allows users to create iCal feeds in Views, and import iCal feeds
from other sites using the Feeds module. Any entity can act as the source of
events for an iCal feed, as long as that entity contains a Date field. Date
iCal creates a new iCal "view mode" for all entities, which is used to format
the Description field of the events in the iCal feed.
This module contains code to create an iCal feed in Views. It has been pulled
out of the Calendar iCal module because it has no dependency on Calendar and it
could be used on any view. The code has also been generalized so that it will
work for any entity, not just nodes. It creates an 'iCal' view mode for every
entity type that can be used to to configure the description used in the iCal
feed, and adds theme suggestions to tell Drupal to look for an iCal version of
the entity template.
The Calendar iCal module will be deprecated in favor of this module.
INSTALLATION
Future plans for this module:
- Add in an iCal parser for the Feeds module that can parse an iCal feed from
another site so it is possible to import as well as export iCal information.
- Add in ways to take advantage of other parts of the iCal specification,
like LOCATION or VALARM.
- Add some pre-configured features that illustrate how to set up a site
that provides an iCal feed and consume iCal information from other sites.
Date iCal has several required dependencies, and an optional one:
- The Views, Entity API, Libraries API (version 2.0), and Date modules are required.
- The iCalcreator library is required.
- PHP 5.3 is required by the iCalcreator library to properly handle timezone
data. Date iCal *might* work with PHP 5.2, but that configuration is
untested and unsupported.
- The Feeds module is optional, but it's needed to enable import of iCal feeds
from other sites.
To use this module to create an iCal feed:
To install the iCalcreator library, download it from
http://kigkonsult.se/downloads/index.php#iCalcreator and extract the zip file.
Inside that file you'll find iCalcreator.class.php. Copy that file to a folder
in your Drupal site named "sites/all/libraries/iCalcreator".
- Enable Date API, Views, and Date iCal.
- Go to the Display Fields screen for the entity you want to export in an iCal
field. You will see that there is a new view mode for all entities, called
To confirm that iCalcreator is installed correctly, log in to your Drupal site
and navigate to the admin/reports/status page. If the row titled "Date iCal" is
green, Date iCal is ready to go. If it's red, the iCalcreator library is not
properly installed. If it's missing, you'll need to enable Date iCal and then
come back to this page.
HOW TO CREATE AN ICAL FEED
- Go to the Manage Display page for the entity you want to export in an iCal
feed. You will see that there is a new view mode for all entities, called
'iCal'.
- Set up the iCal view mode to contain whatever should be exported as the
'Description' field for the iCal field. You can trim the text to the desired
size, include other fields, etc.
- Optional, but recommended, create a new node.tpl file for the iCal view mode,
using the name ENTITYTYPE--ical.tpl.php or ENTITYTYPE--BUNDLE--ical.tpl.php.
Make this a very simple template that omits the title, submitted by
information, links, and comments. Place that file in the theme folder.
- Clear the cache so the new template can be discovered by Drupal.
- Create a new view containing the items you want to display in the iCal feed.
- Add a feed to the view, using the feed type 'Date iCal'.
- Choose to 'Show' the feed as 'Date iCal Entities' (rather than 'Content' or
'Fields').
- In the settings for Date iCal Entities, select the specific date field
that should be used as the event date for the iCal feed.
- Give the feed a path like 'calendar/ical/%/calendar.ics', where you have a
'Description' field for the iCal feed. You can trim the text to the desired
size, include additional information from other fields, etc.
- Create a new View that displays the entities that you want to include in the
iCal feed.
- Add a "Feed" to the view. Change the Format to 'iCal Feed'. When you click
Apply from that dialog, you'll be given the option to name the calendar. This
name will appear in your users' calendar clients as the calendar's title.
- Change the Show setting to 'iCal Entity' (rather than 'Content' or 'Fields').
- In the settings for iCal Entity, select the date field that should be used
as the event date for the iCal feed. Make sure that you choose a field that
is a part of every entity that your View displays. Otherwise, the entities
which don't have that field will be left out of the iCal feed.
- You may optionally choose a field that will be used to populate the Location
property of events in your iCal feed. This field can be either a text field
or a Node Reference field, in which case the title of the node will be used.
- Give the feed a path like 'calendar/%/export.ics', where you have a
'/%/' for every contextual filter in the view.
- Add date filters or arguments that will constrain the view to the items you
want to display in the feed.
- Attach the feed to a page view.
- Make sure the Pager options are set to "Display all items".
- Add date filters or arguments that will constrain the view to the items you
want to be included in the iCal feed.
- Navigate to the page view. You should see the iCal icon at the bottom of the
view. If you click on the icon it will download an .ics file with the events
that matched the view criteria.
HOW TO IMPORT AN ICAL FEED FROM ANOTHER SITE
- Install the Feeds module, which acts as the framework around Date iCal's
calendar import functionality.
- Login to your Drupal site and navigate to the admin/structure/feeds page.
- Click the "Add importer" link, and give it a name and description.
- Clicking "Create" will bring you to the general Feeds importer settings page.
This page displays some general information about makign Feeds importers,
which you should familiarize yourself with.
- In the left sidebar, you'll see "Basic settings", "Fetcher", "Parser", and
"Processor". The Parser and Processor settings are what we're interested in.
- In the Parser section, click "change". This will bring up the Parser
selection page, on which you should select the radio button for "iCal Parser"
and then click Save.
- Now, under Processor, click the "Settings" link. Most of the time, you'll
want to use the "Update existing nodes (slower than replacing them)" setting.
Then select the Content type of the nodes you'd like to create from iCal
events. You can leave the other settings as their defeaults, or change them
as you need. Click Save.
- Now click the "Mapping" link at the bottom of the left sidebar. This page is
where you'll define how iCal event properties get mapped into your nodes'
fields. Expand the "Legend" for a detailed description of each source and
target field. Sources are the attributes available in iCal event objects.
Targets are the fields in your nodes.
- Most of this setup is going to be dependant upon how your content type's
fields are configured, but there are some universal requirements:
1) You must map the "UID" source to the "GUID" target. Then, after clicking
"Add", click the gear-shaped button that appears in the new table row,
and check the "Unique" checkbox. Then click "Update", and then before
you add any more mappings, click "Save" at the bottom of the page.
2) If you're going to map both the "Date start" and "Date end" sources, you
MUST ensure that the "Date start" mapping is above the "Date end" mapping
in the table. This is because of an implementation detail in the parser.
3) It's a good idea to map the "Summary" source to the "Title" target, and
the "Description" source to whatever field is the "body" of the node.
- Once you've completed all the mappings, click the "Save" button on the
bottom left side of the page.
- Now you can import the iCal feed into nodes by going to the /import page of
your site (e.g. http://www.exmaple.com/import). Click the link for the
importer you just created, and enter the URL of the feed you'd like to
import into the "URL" field. Click the "Import" button, and observe the
progress.
- Once it's done, you should see a green message saying "Created X nodes." If
you do, you've successfully set up your iCal importer. If you get some other
message, you'll need to tweak the importer's settings.
Additional Notes:
The Feeds plugin was originally written by ekes, for the "iCal feed parser"
module (http://www.drupal.org/project/parser_ical). It was modified and
improved for Date iCal by coredumperror.
At this time, Date iCal supports outputting iCal calendars only for groups of
events. To put an "Add to calendar" button on individual event nodes, try the
<a href="http://drupal.org/project/addtocal">Add to Cal</a> module.
Developers who wish to implement more powerful manipulation of event data can
read the date_ical.api.php file to learn about the various alter hooks that
date_ical exposes.
......@@ -26,7 +26,7 @@ function date_ical_requirements($phase) {
else {
$requirements['date_ical'] = array(
'title' => $t('Date iCal'),
'value' => $t('iCalcreator library could not be found, check the installation instructions for Date iCal'),
'value' => $t('iCalcreator library could not be found, check the installation instructions for the Date iCal module.'),
'description' => $t('The error message was: @error<br>!error_message', array('@error' => $library['error'], '!error_message' => $library['error message'])),
'severity' => REQUIREMENT_ERROR,
);
......
......@@ -29,9 +29,11 @@ abstract class DateIcalFeedsParser extends FeedsParser {
// Want to have the sources as a property of the class,
// but can't declare them with t().
$sources = $this::$sources;
foreach ($sources as $key => &$value) {
if ($key == 'name' || $key == 'description') {
$value = t($value);
foreach ($sources as &$source) {
foreach ($source as $key => &$value) {
if ($key == 'name' || $key == 'description') {
$value = t($value);
}
}
}
// Call parent::getMappingSources() to trigger additional target creation.
......
......@@ -149,6 +149,13 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
$field_name = 'revision_timestamp';
}
if (!isset($entity->$field_name)) {
// This entity doesn't have the date property that the user configured
// our view to use. We can't do anything with it
return;
}
$date_field = $entity->$field_name;
// Pull the date value from the specified field of the entity.
$entity->date_id = array();
$start = NULL;
......@@ -158,8 +165,8 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
if ($is_field) {
$items = field_get_items($this->entity_type, $entity, $field_name);
if (!$items) {
// This entity doesn't have the date field that the user configured our
// view to use. We can't do anything with it.
// This entity doesn't have data in the date field that the user
// configured our view to use. We can't do anything with it.
return;
}
$date_field = $items[$delta];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment