Home » 2005 » February » 18

Daily Archives: Friday, February 18, 2005

The Most Versatile VoIP Provider: FREE PORTING

ISP-In-A-Box: The $500 Mac mini (Chapter XI, Web Calendars)

If you’re a big fan of the Mac’s iCal calendaring application like we are, then you will love this addition to your web site. Today we’re going to install PhpiCalendar which does one thing, but does it incredibly well. PhpiCalendar displays picture-perfect web calendars (see inset) of all of your iCal information which can be accessed from anywhere using a web browser. Do you need a .Mac account? Nope. All you need is an ISP-In-A-Box running the Apache Web Server and PHP. You’ll also need to install Webmin to handle the crontab task discussed below unless you’re familiar with the crontab application itself. And we’ve already covered how to password-protect your calendar web site if you want to. Because PhpiCalendar reads .ics calendars (IETF 2445 files), you can also use it to access calendars created with Mozilla Calendar and Sunbird, Novell’s Ximian Evolution, KOrganizer, and WinDates 5.0. Did I mention there are also thousands of free, downloadable .ics calendars at iCalShare that cover every imaginable subject matter: holidays of every flavor, astronomy, TV schedules, DVD release dates, iTunes release dates, sports schedules, band schedules, and on and on. So let’s get started.

We’ll first download the application, and then move it to a folder on your web site. Then we’ll load your existing iCal calendars and test the application. Once everything is working, we’ll add an entry in the crontab file to copy your iCal data over to PhpiCalendar each day at one or more times that you specify.

Downloading PhpiCalendar. PhpiCalendar is one of thousands of applications which are available at no cost on SourceForge.net. Just click here to download the latest 2.0 beta and choose a download site near your location to begin. The application will be copied to your desktop and then automatically decompress into a folder called phpicalendar-2.0b. Let’s rename the folder to something simpler. Just click on the existing folder name and change it to ical.

Moving PhpiCalendar to Your Web Site. Open a Finder window, click on your local hard disk, and then move to the /Library/WebServer/Documents folder. Now click-and-drag the iCal folder on your Desktop into the Documents folder. Now you can access your Web Calendars by going to http://localhost/ical/ or http://yourdomain.com/ical/. Test it now using your web browser. Your own iCal information will not appear, but some sample calendar events will.

Importing iCal Data into PhpiCalendar. In order to import your iCal calendars into PhpiCalendar, we first need to figure out where your iCal data is stored. Using Finder, press Command-F and search for file names on your local hard disk that contain .ics. Click on one of the file matches to display its location which should be something like the following: /yourname/Library/Calendars where yourname is your Mac login ID. Write down what you found, and then open a Terminal windows (Freudian slip?) and switch to root user access: sudo su. Enter your admin password. Now let’s clean out the sample calendars that were distributed with PhpiCalendar and copy your own iCal data into the PhpiCalendar folder:

  • cd /Library/WebServer/Documents/ical/calendars
  • rm Home.ics
  • rm Work.ics
  • cp /Users/yourname/Library/Calendars/*.ics /Library/WebServer/Documents/ical/calendars
  • Now refresh your browser at http://localhost/ical/ and your very own iCal data should now appear in the web calendar. Click on the small icons in the upper right section of the main screen to change from daily to weekly to monthly to yearly views. You can permanently save your preferences by clicking on (you guessed it!) Preferences.

    Automating PhpiCalendar Updates. Because PhpiCalendar operates independently from iCal, we need to automate the process of copying your calendars from iCal each day. We’ll do it with crontab using the Webmin application we installed last week. Make sure Webmin is running (/etc/webmin/start), and then open it with your web browser: http://localhost:10000. Click on the System button and then Scheduled Cron Jobs. Then click Create a new scheduled cron job. Make the following entries in the form and then click the Create button. Leave the default settings unless specified below:

  • Execute cron job asroot
  • Commandcp /Users/yourname/Library/Calendars/*.ics /Library/WebServer/Documents/ical/Calendars (use your actual username for yourname, of course)
  • When to executeTimes and dates shown below
  • Minuteclick on Selected and click on any minute desired
  • Hourclick on Selected and click on any hour desired or Ctrl-Click on several hours to run multiple times each day
  • Days, Months, WeekdaysAll
  • Once you have assured that your calendars are being updated daily, you can silence email advisories by adding > /dev/null 2>&1 to the end of the Command in your cron job. Just click on the job, make the change, and click Save. Check back with us next week for some more terrific applications. Have a great weekend!