1 of 2
1
iCal plugin
Posted: 20 April 2006 02:45 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  53
Joined  04-18-2002

I’d like to allow users to be able to share a calendar which will enable them to see what times I’m available during the day.  While logged in, they can easily see what times are open then schedule an available time to meet me.  It would be great if it published to an iCal RSS feed so anyone can subscribe to the data.

Anyone have any ideas on what apps can plugin to ee to accomplish this?  Or how I may be able to do this a different way?

Chad

Profile
 
 
Posted: 20 April 2006 02:51 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  36400
Joined  05-14-2004

This has been requested a few times over the years for EE, but no one has yet stepped forward - to my knowledge - to make one.  So you’d need to custom code it, or hire someone to.

 Signature 
Profile
MSG
 
 
Posted: 20 April 2006 02:53 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  53
Joined  04-18-2002

I figured as much.  Thanks Lisa!

Profile
 
 
Posted: 20 April 2006 02:55 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  758
Joined  08-16-2003

I’ve been sorta kinda maybe thinking about getting a group of people together to work on this. But that would require the time to organize the effort, much less to actually do the coding. So although I’m not stepping forward just yet, I am thinking about sheepishly raising my hand.

Profile
 
 
Posted: 20 April 2006 04:13 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  12-12-2002

iCal and most decent calendaring applications read and write files to the iCalendar format.  It’s not RSS, but it’s just as simple.  You’ll need to bone up on the documentation for advanced events, but all you need to do is create a regular file formatted in iCalendar just like you would with RSS. No plugin needed.  Be careful of extra spaces and returns, it’s fickle about this.

I just got this working the other day for a new client, and was very surpised how smoothly it went.  Here’s an example:

http://www.centerforsocialmedia.org/site/events/

The sidebar has a link to “Subscribe to iCalendar” which is a regular href link but with the webcal:// protocol instead of the http:// protocol.

Here’s my code:

BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-CALNAME:Center for Social Media
PRODID
:-//hacksw/handcal//NONSGML v1.0//EN
X-WR-TIMEZONE:US/Eastern{exp:weblog:entries weblog="yourweblog" show_future_entries="yes"}
BEGIN
:VEVENT
UID
:{entry_id}
DTSTAMP
:{entry_date format="%Y%m%dT%H%i%sZ"}
DTSTART
;VALUE=DATE:{entry_date format="%Y%m%dT%H%i%sZ"}
DTEND
;VALUE=DATE:{entry_date format="%Y%m%dT%H%i%sZ"}
SUMMARY
:{title}
DESCRIPTION
:{exp:filter_html rules="-table -td -tr -p -a -span -i -b"}{summary}{/exp:filter_html}
END
:VEVENT{/exp:weblog:entries}
END
:VCALENDAR
 Signature 

Gridwork Design * Site design for small organizations

Profile
 
 
Posted: 20 April 2006 09:39 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  263
Joined  06-04-2003

This deviates somewhat, but ... (puts down late-night sandwich)

I was thinking of adding a calendar function to an upcoming redesign of our main site, using something like one of the free iCal-related calendar things that have appeared recently. The project’s a few weeks away and there are other, more pressing decisions about the redesign to deal with, so I haven’t pursued that as yet.

But Google’s recently announced calendar gave me pause to think again: why can’t I use that as a calendar function for our site? I haven’t read everything on it, for reasons stated above, but for now it’s an option I intend to look at - just put a link to a Google calendar which lists all our events, etc.

Anyone else had such thoughts?

(Picks up sandwich again ...)

Profile
 
 
Posted: 21 April 2006 03:27 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
RankRank
Total Posts:  122
Joined  01-20-2003

I think we’re going to see all sorts of neat things revolving around Google Calendar real soon, they released a calendar API today and you can subscribe to Google Calendars from iCal.

http://www.google.com/calendar/
http://code.google.com/apis/gdata/calendar.html

Profile
 
 
Posted: 21 April 2006 03:53 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  215
Joined  05-15-2004

So basically, we need to get a google Calendar module going soon.  (I’ve got a need for one…so I just might bite on it.)

Whew.  Just went back and read the API.  This is going to be alot of work.  Might be worth it though.  Anyone interested in co-development or perhaps subsidizing such a project?

 Signature 

Ed
King of Fools
Blogrescue.com

Profile
 
 
Posted: 21 April 2006 09:25 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
RankRankRank
Total Posts:  877
Joined  08-05-2005

Seamus - is this the entire contents of your events/ical template? What exactly do you mean by this:

You’ll need to bone up on the documentation for advanced events

Can you point to a resource for learning more about this?  I’m really intrigued.  Thanks for the info.

Profile
 
 
Posted: 21 April 2006 10:41 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  12-12-2002

Yes, that’s the whole file.  If you try it out in a calendaring application, you’ll see that all the events are at a specific time on a specific day.  I probably exaggerated by using the term “advanced events” since all that’s required for events with duration, or todos, or meetings, or alarms, or repeating events is just tweaking the syntax.  I just pored over the wikipedia entry on icalendar and opened up a few ical files in my text editor to see how things were constructed.

Oh, and I published the file as an RSS feed for the document type in EE.  I think a pretty decent calendar system can be constructed with EE as it exists right now.  The only thing I couldn’t figure out was how to show events that lasted more than one day on the mini calendar.

I’m curious what you’d need Google Calendar for that EE can’t do.  As far as I can tell, Google’s system still requires a Google Account. Fortunately, if you did want to use Google for calendars, they do publish calendars in RSS as well as iCal.  So you could do some integration right now with that.  Ideally, someone will write an iCalendar parser for EE, which I could see being pretty useful.

 Signature 

Gridwork Design * Site design for small organizations

Profile
 
 
Posted: 21 April 2006 11:23 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
RankRankRank
Total Posts:  877
Joined  08-05-2005

Wow - I’ve just implemented. I’ll be using this a lot! Many thanks!

Profile
 
 
Posted: 21 April 2006 11:28 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
RankRankRank
Total Posts:  877
Joined  08-05-2005

The only thing I couldn’t figure out was how to show events that lasted more than one day on the mini calendar.

Probably you can do this with the expiration date.  iCal displays an end time.

Profile
 
 
Posted: 22 April 2006 09:51 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  758
Joined  08-16-2003
The only thing I couldn’t figure out was how to show events that lasted more than one day on the mini calendar.

You can’t, at least not natively. Repeet can do that, though.

Profile
 
 
Posted: 22 April 2006 12:59 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
RankRankRank
Total Posts:  877
Joined  08-05-2005

I suspect we are talking about two different things.  If an event lasts say, a weekend, setting the expiration date does work.  The example above places the entry date in the expiration date field so that just has to be changed.  In iCal, it’s only really visible if you are viewing by the week or when you view a detail of the event.  If you want repeating events, they’d have to be entered manually or with Repeet.  I haven’t tried this yet, but I will when I have more time.  I have some users that are going to absolutely love this.

Profile
 
 
Posted: 22 April 2006 01:44 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
RankRankRank
Total Posts:  877
Joined  08-05-2005

on the mini calendar

Just realized you might be talking about on your web page and not iCal - if so, scratch what I said wink

Profile
 
 
Posted: 03 June 2007 09:48 PM   [ Ignore ]   [ # 15 ]  
Grad Student
Rank
Total Posts:  96
Joined  08-31-2005

@seamus: were you able to use your template and import events into google calendar?

i’m using your template but google won’t accept it, it keeps telling me it can’t parse events from the file. the url is: http://www.kncsb.org/calendar/ical

Profile
 
 
Posted: 19 September 2007 08:36 AM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  115
Joined  11-12-2002

Seamus:

Your Expression Engine calendar template is incorrect. Looks like it’s outputting linebreaks in the description field.  All linebreaks need to be specified as \n in the vCal standard.

iCal.app is balking at the linebreaks and I assume other clients will as well.

http://www.centerforsocialmedia.org/site/events/

Profile
 
 
Posted: 19 September 2007 02:58 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  115
Joined  11-12-2002

I wrote a plugin today called “pi.vcal_encode.php”. The plugin cleans up formatting, html and most importantly adds proper ”/n” linebreaks to the data.  The tag is wrapped around both title and body data.

My template: (served as xml)

BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-CALNAME: My Event Calendar
PRODID
:-//My/ Events//NONSGML v1.0//EN
X-WR-TIMEZONE:US/Eastern
{exp
:weblog:entries weblog="events" status="not closed" show_future_entries="yes" disable="member_data|pagination|trackbacks|categories" show_expired="no"}
BEGIN
:VEVENT
UID
:{entry_id}
DTSTAMP
:{entry_date format="%Y%m
T;%H%i&#xsZ;"}
DTSTART
;VALUE=DATE:{entry_date format="%Y%m
T;%H%i&#xsZ;"}
DTEND
;VALUE=DATE:{entry_date format="%Y%m
T;%H%i&#xsZ;"}
SUMMARY
:{exp:vcal_encode}{title}{/exp:vcal_encode}
DESCRIPTION
:{exp:vcal_encode}{body}{/exp:vcal_encode}
END
:VEVENT{/exp:weblog:entries}
END
:VCALENDAR


You can see it in action here:

webcal://www.bmi.com/events/ical

http://www.bmi.com/events/


There are definitely more characters that I should escape, but I’m happy with this as a starting point.  More as my team tests this…

File Attachments
pi.vcal_encode.php.zip  (File Size: 2KB - Downloads: 384)
Profile
 
 
Posted: 20 March 2008 02:14 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  115
Joined  11-12-2002

I just completed further revisions to the template code.

- better conformity with vCal spec

- limit the data returned from the template by adding time limits
  - 1 month back
  - 1 year forward

(make sure to serve as XML and all php in the template at the input stage)

<?php
// last month in 'd-m-Y' format
$uts['lastmonth'] = strtotime( '-1 months' ); // or, strtotime( 'yesterday' );
$last_month = date( 'Y-m-d g:i A', $uts['lastmonth'] );

// next year in 'd-m-Y' format
$uts['nextyear'] = strtotime( '+1 years' ); // or, strtotime( 'yesterday' );
$next_year = date( 'Y-m-d g:i A', $uts['nextyear'] );
?>BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-CALNAME:BMI Event Calendar
PRODID
:-//BMI/ Events//NONSGML v1.0//EN
X-WR-TIMEZONE:US/Eastern
{exp
:weblog:entries weblog="events" status="not closed" show_future_entries="yes" disable="member_data|pagination|trackbacks|categories" show_expired="no" orderby="date" sort="asc" start_on="<?php echo $last_month; ?>" stop_before="<?php echo $next_year; ?>" limit="1000"}BEGIN:VEVENT
UID
:{entry_id}
DTSTAMP
:{entry_date format="%Y%m%dT%H%i%sZ"}
DTSTART
;VALUE=DATE:{entry_date format="%Y%m%d"}T120001
DTEND
;VALUE=DATE:{entry_date format="%Y%m%d"}T120002
SUMMARY
:{exp:vcal_encode}{title}{/exp:vcal_encode}
DESCRIPTION
:{exp:vcal_encode}{long}{/exp:vcal_encode}
END
:VEVENT
{
/exp:weblog:entries}
END
:VCALENDAR
Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77557 Total Logged-in Users: 52
Total Topics: 101552 Total Anonymous Users: 30
Total Replies: 544386 Total Guests: 266
Total Posts: 645938    
Members ( View Memberlist )