Feng Office
I started working on Feng Office after deciding to use the calendar module.
On attempting to import calendar data from other programs in iCal format I discovered that many or all imported calendar entries were not being created with the correct times. Further investigation showed that even version 1.7.5 doesn't have true time zone support. The time zone support is very rudimentary - namely a fixed offset from GMT which didn't allow for a different offset for the same time zone at different times of the year ("daylight savings time"). So you have to change your time zone during the summer if the internal representation of date/time values is to be correct (UTC), which results in the calendar entries from the winter being displayed wrongly. To be fair, this is most likely due to Feng Office having originally been built for earlier versions of PHP which didn't know about time zones. There is a forum entry from two years ago which mentions DST support as a possible future improvement. Other forum entries suggest auto-setting of the offset using the browser as a solution but this really doesn't help much because the system still suffers from the treat-full-year-as-subject-to-current-offset problem. Indeed, in this forum post the solution of changing the current offset is suggested "for now" so it seems that they don't consider the offset system as proper time zone support.
It's therefore unsurprising that the iCal export, import and feed in 1.7.5 don't properly support time zones either. The export and feed include a basic VTIMEZONE component but without DST support it's pretty pointless as all entries are output with the user's current offset regardless of the offset which should be in effect on the date of the calendar entry. In addition, the entries don't explicitly reference the VTIMEZONE component.
I decided to tackle these issues and add decent time zone support.
My solution makes use of the following:
- PHP 5.2+ for its time zone functionality - thereby raising the requirements for Feng Office, but I don't think that 5.2 is excessive considering that it was released in November 2006.
- iCalCreator for preparation and parsing of iCal content (with some changes and additional functions, which I have contributed and hope will be included in that library)
- jsTimezoneDetect for a best-effort detection of the user's "Olson" timezone
Because I didn't really check the old code for all its problems, but instead wrote new code from scratch, it's hard to identify every problem which was fixed. That said, significant functionality provided by this patch includes the following:
- User/Company/Contact time zones are defined as named time zones rather than as fixed offsets from GMT. When times are converted from/to UTC (internal representation) the appropriate offset is retrieved from the "Olson" TZ database as implemented by the PHP installation in use.
- Browser time zone detection sets an "Olson" TZ time zone for the user, using its best estimate. When browser time zone detection is activated in the user profile, the TZ name returned by the browser is shown.
- Calendar entries have a "location" field (included in the import/export/feed).
- When importing iCal files, the time zones don't have to match those known to PHP; where required, the VTIMEZONE data supplied in the file is used to convert all times to UTC.
- When exporting and in the feed, VTIMEZONE components are included, but only those required for the relevant period.
- The iCal feed can declare entry times in any time zone (including explicit Z=UTC), with VTIMEZONE (as above) or without (as "floating" times), to facilitate use with quirky clients.
- When importing iCal files, all-day events are detected as all-day events, even if defined as a 24-hour period rather than by date only (Outlook does this).
- All-day events are exported according to the RFC without time information, but matching the date on which Feng Office shows the entry (see future plans below).
- Alarms can optionally be included in the iCal feed/export (similar to my previous patch).
- The iCal feed/export includes the SEQUENCE element (although not implemented strictly according to the RFC) which is required to ensure that changes are "seen" by clients.
- The iCal feed/export lists all invitees. But on import the events are only created for the current user even if other Feng Office users appear among the invitees listed in the entry (This is deliberate).
- The iCal feed can be restricted to a certain number of months back (starting from the beginning of the month) to allow minimising data plan use with mobile devices where there are large numbers of past calendar entries.
- The iCal feed button can be set to generate a webcal:// URL rather than an http:// URL for use on computers which have a webcal:// handler. This is particularly useful where the feed is provided over https and is to be imported into MS Outlook as manual configuration is not intuitive.
With this version of iCal export I can successfully see my calendar in Android using ICSSync - the phone reads the calendar directly from FengOffice without involving Google Calendar. The query string I personally use is &isw=1&tz=user&rem=1&mback=6
The switches available for the feed URL are:
isw=1|0
- (default 0) Include sub-workspaces (unchanged)
vtz=1|0
- (default 1) Include VTIMEZONE components
rem=1|0
- (default 0) Include pop-up reminders
mback=n
- where n is how many months to go back to start the calendar feed
Not all of these switches and options are available in the feed link shown on the calendar pages - some have to be added to the URL manually.
Different versions of the patch can be found in the attached files. Installation instructions are included. Comments on the patch can be made in the relevant forum topic.
Future plans
To start with I would like to address the gaps between Feng Office's calendar entry options and what can be defined in iCal. These include:
- Missing types of event recurrence (Forum, although that particular example may already have been addressed)
- Event recurrence exceptions (based on contributed code in the forums)
- Storing a time zone with event start times so that original time zone information isn't completely lost.
- Handling of true multi-day events (and not requiring use of repeating events) - perhaps by allowing user to flip between Duration and End Date/Time? There is a big difference - a multi day event could start at 3 on Friday and run until 11 on Sunday, but a repeating event can't; you'd need three separate events for that time period. Events like this can be imported so it's important to be able to edit them.
- Zero-duration entries should be visible in the calendar view (See Forum). You can't create such entries in Feng Office but you can import them, but then they're practically invisible.
I would like to integrate the previously contributed patch to include tasks as VTODO, but using the iCalCreator library. This would probably be activated with a switch as not all clients would know what to do with VTODO entries.
Comments on the future plans above can be made in the relevant forum topic.
In addition, there are some issues which probably don't qualify as "bugs" which may benefit from attention:
- A configuration option could be added (at system or user level) for calendar time increment settings (See Forum).
- All-day events still have a specific start time, even though this is disregarded for many purposes, and other users see the event as an all-day event occuring on their local date at the time the event starts. For example if a French user defines a full-day event where the start time is 01:00 (or even 00:00) a New York user will see the event on the day before because that is the date for the New York user at the time the event begins. It would perhaps be more correct to show the event to other users as the 24-hour period of the French day, and only as an all-day event where the 24-hour period is a complete day in the user's time zone. See Forum.
- Similarly, an option could be added to output all-day events in iCal export/feed as 24-hour-duration events as Outlook does, rather than by date only.
I need to check whether the following problems are present:
- iCal feed/export may not be limited to the user's calendar (according to invitation) and rather includes ALL events in the selected workspaces. (Known issue - Forum) (Basis for possible fix: Forum) (Apparently already supported? Forum and Forum)
- Google calendar character handling (Forum) - perhaps I can integrate some sort of work-around if it's needed
Other things
I want to investigate the bug which results in the wrong week/month shown when you want to see a Sunday (Forum and Forum) - somehow this affects me even in 1.7.5, maybe because of my week-start setting, but that shouldn't matter; it ought to work properly in all cases!
It has occurred to me that it would be nice to display external iCal feeds in the Feng Office calendar display (Forum) This could probably also form the basis for displaying special event calendars (non-editable) but I think reliable support for ALL iCal features should be present before we try to display external feeds (especially those features related to recurrence rules and recurrence exceptions).
I would also like (some time in the future) to add an option to display the date according to a second calendar on the calendar display.
Download
fengoffice_1_7_5_onebigsystem1.zip