Author Topic: Timezone support patch  (Read 9958 times)

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Timezone support patch
« on: January 01, 2012, 06:44:07 PM »
After quite some work I would like to present a patch which adds true (I hope) time zone support to Feng Office 1.7.5.

The main benefits are proper handling of daylight savings time and correct handling of time zones in iCal imports, exports and feeds.

From the number of relevant forum topics created over the years on this subject, I suspect that this is quite an important issue to have addressed.

A full description is available at /en/content/feng-office on onebigsystem.com (sorry, I have to write it that way as I can't post links here), from where the patch can be downloaded.

Please comment on this patch here in the forums.

Once I have had some confirmation that it behaves properly I hope to continue work and ensure that all the core functionality of iCal exists in Feng Office too, since iCal is the underlying format used for CalDAV and SyncML.

If this version or a future version of this patch is ever included in a future official release (I hope it will be), I might have a go at implementing CalDAV using SabreDAV.

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Re: Timezone support patch
« Reply #1 on: January 14, 2012, 02:02:27 PM »
Is no-one interested in this?  :(

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #2 on: January 31, 2012, 06:45:48 AM »
Hi YLAVI,

thanks a lot for your post. Im really interested in your work and I would like to test it. Unfortunately Im not an expert in programming, so there are a few questions to be answered before starting the test:
  • Could you show some visual examples or an online demo of your changes?
  • Is it possible to patch a running system including some project data without loosing settings and users, documents and so on?
  • Has the update of the database to be performed by using phpmyadmin? Is the data secure?
  • Is there a possibility to patch the system online? (Im using a webhosting service with FTP access (no server))

Thanks in advance!

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Re: Timezone support patch
« Reply #3 on: January 31, 2012, 06:29:53 PM »
Hi smet

It's OK - you don't have to be even a newbie at programming  ;)

When you ask for examples do you mean how to make the changes or what the changes are? I assume that you mean the latter - in which case while I could make some screenshots, there's not that much to show. (But if I find some time I'll make some anyway and add them to my page). The big changes are in the content of exported ical and the processing of imported ical. As far as I can recall right now, the visible changes are limited to:
  • extra options for the calendar feed link, when displayed
  • changes to the time zone selector
  • a "location" field in calendar entries right by the time/duration
The time zone selector in standard Feng Office offers options like GMT-1, GMT, GMT+1 etc. Installing my patch replaces that with a list of time zones like Europe/London, Europe/Paris, America/New_York - and Feng Office gets the offset for each date as required. It will know that between certain dates the offset is GMT+/-y and the rest of the time it's GMT+/-x.

The database changes can be made using any tool you like which is capable of running those sorts of queries on the database. phpmyadmin is one option but I'm sure there are other ways you can do it.

Your data should be perfectly safe; the database script doesn't touch any existing columns - it only adds four new ones. That said, make a database backup anyway! Also (if I recall correctly) until you select a named time zone, your users'/contacts' existing time zone offset settings will continue to be honoured, so you won't be immediately defaulted to UTC/GMT.

I think I understand what you might mean by patching the system on-line. I'm afraid I don't know how to do that. What I would suggest is to unpack the standard distribution twice, prepare one of the sets of files according to the instructions, and compare it to the other to find out which specific files are different and need to be uploaded. Alternatively perhaps your FTP program can do a comparison and tell you whch files are different to what you already have on-line.

I hope that helps - I'll be happy to hear any further questions

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #4 on: February 01, 2012, 06:33:08 AM »
Hi YLAVI,

thanks for your detailed response! I'll backup the database and the whole system before starting to patch it. Because I already made some changes, I'll download all files. It is a good idea to make a copy and to patch the copy. Can you recommend a tool for patching? I found this one: gnuwin32.sourceforge.net/packages/patch.htm

Afterwards I will upload the files, hoping that my FTP program recognizes the differences. If not, it will last a bit longer ;-)

Kind regards.

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #5 on: February 01, 2012, 06:28:47 PM »
Hi YLAVI,

I had to to do one more step before I could update the system: I had to convert your .patch-files in an ASCII format, because the patch-tool didn't accepted your files in the native format. After the conversion everything seemed to be running correctly. The update of the database was also free of errors. Four changes were done.

Unfortunately now I get some mistakes after patching and uploading all files:
  • All tabs with user-related content are empty (e.g. calendar, documents, contacts, ...) and a 500: Internal server error is shown
  • If I click on "Actualize user profile" in the administration menu I get the following error code: "og.detect_tzname is not a function" Changes in the user profile seem to be done.

Ive set all users to a specific timezone (your new drop-down menu) and I set the automatic detection of the timezone (by browser settings) to "no". => No success. The 500 error still occurs.

Any ideas? What went wrong?

Thanks in advance!

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #6 on: February 01, 2012, 06:38:13 PM »
I just switched on the debug mode and I get the following error codes:
  • In Overview tab: "Fatal error: Call to undefined method DateTime::setTimestamp() in /mnt/.../application/models/users/User.class.php on line 705
  • Other tabs: "Fatal error: Call to undefined method DateTime::setTimestamp() in /mnt/.../application/models/users/User.class.php on line 745"

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Re: Timezone support patch
« Reply #7 on: February 01, 2012, 08:21:19 PM »
Hi smet

I just saw your message now - unfortunately I don't have time right now to go deep into your problem.

From the errors you reported it seems as if your PHP doesn't have the setTimestamp function. Do you have PHP 5.2 on your webhost? That might explain it as setTimestamp was added in 5.3 it seems.

I don't think I added calls to DateTime::setTimestamp() which weren't there before, but maybe the standard code doesn't ever run in a way which calls that function.

"og.detect_tzname is not a function" is a bit surprising - the first thing I would check is that all the changes were made correctly and that public/assets/javascript/og/og.js was patched properly - that's where og.detect_tzname should be declared. But I assume you would have noticed errors from the patch process and that's not the problem, in which case I am stuck for an answer. Disabling automatic timezone detection won't help because (as you will see in application/layouts/website.php) the function is always run to get the time zone - the setting just controls whether the result is used or not.

I hope this does help and you make some progress; please keep me/us updated with anything new you find out.

Good luck!

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #8 on: February 02, 2012, 04:24:25 PM »
Hello YLAVI,

thanks to your help I solved the biggest problem: the missing method DateTime::setTimestamp(). Switiching from PHP5.2.x to 5.3.x was the solution! Now I can see all pages with content.

The error "og.detect_tzname is not a function"  still occurs. Therefore I'll check the og.js and perhaps repeat the patching from scratch. Maybe there was a problem because of my conversion to ASCII format? I had to convert the *.patch files because the patching tool couldn't correctly recognize the line breaks (LF to CR-LF).

There are also some smaller problems when trying to export the calendar. In some combinations of your new settings (check boxes) in the calendar tab  the generation of an ics file is not possible and I resolve an error.

I will inform you about news!

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Re: Timezone support patch
« Reply #9 on: February 02, 2012, 05:34:39 PM »
I'm glad to hear that your system is working again.

Rather than redoing the whole patch you might just want to find the right part of the patch file and add the new code manually.

Some problems with generation of ICS might be expected if you are including time zones and not outputting in UTC. I submitted my changes to the iCalCreator project and the maintainer there pointed out some inefficiencies in my code which might only work if you adjust some settings in php.ini. Now I know that someone out there really needs the fix I will try to make the time to improve my code.

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #10 on: February 06, 2012, 01:05:19 PM »
Hello,

to solve the problem "og.detect_tzname is not a function" I have manually matched the changes in the patch file and the og.js (by the way I couldn't find any differences between the automatically and the manually patched file). Furthermore I deactivated JS compression in my config.php which I had added some days before to speed up my system. Now I don't get the "...is not a function" error.

But: There are still errors reported in my log.php. There seem to be problems in the User.Class.php in the lines: 711, 750 and 770. The error messages are all the same, for example:

#1 ERROR: Error: Undefined variable: value in '/.../application/models/users/User.class.php' on line 711 (error code: 8 )

Is this really an error or only a notice?

The iCal export only seems to be working if the checkbox "Include SubWS" is unchecked. Although it is unchecked appointments of the current WS and all SubWS are exported. It is unexpected but not really a problem. Importing the URL in Google calendar works fine. Reminders are not adopted by the Google calendar.

If anybody is interested I could post the necessary lines to translate the fields added by YLAVI into German.

Kind regards

smet

  • Freshman
  • *
  • Posts: 10
    • View Profile
Re: Timezone support patch
« Reply #11 on: February 10, 2012, 06:00:20 AM »
Postscript: The error message "og.detect_tzname is not a function" is related to JS compression. I decided to switch it off in my (customized) config.php. Using JS cache and CSS compression is fine.

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Re: Timezone support patch
« Reply #12 on: February 18, 2012, 07:50:27 PM »
Hi smet

Thanks for your updates.

With regard to the three issues you raised on Feb 6:

1. The errors you mentioned are indeed code errors, although they may not cause the code to fail completely. A patch file is attached to this posting, and this fix will be included in future versions too.

2. I do see an issue with the "Include SubWS" checkbox, although not quite the same one as you mention. I find that whether or not it is checked I get the WS and its SubWS, at least in the case of "All". I will need to check it further. One thing I wonder, since you say that the export only works if it is unchecked - are you possibly confusing the checkboxes? The checkboxes are to the right of their labels and perhaps you're checking WebCal which might make the export not appear to work. Please confirm that that's not the problem.

3. Please post the translations; I'll include them in my next version.

ylavi

markc

  • Freshman
  • *
  • Posts: 47
    • View Profile
Re: Timezone support patch
« Reply #13 on: September 05, 2012, 01:23:57 PM »
Is this still and ongoing effort?

ylavi

  • Freshman
  • *
  • Posts: 19
    • View Profile
Re: Timezone support patch
« Reply #14 on: September 05, 2012, 05:49:49 PM »
At the moment I don't have time to work on FengOffice. I hope that one day I'll get back to it.
In any case it's extremely unlikely that I'll do anything more for FengOffice 1 now that FengOffice 2 is out.

 

anything