[ABD] phpBB Calendar 0.1.1 (alightner)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

Gremlinn wrote:That sound correct Alightner. And, what I pictured in my head.

Here is a thought. I don't know how easy/hard it would be to do...

Record if DST was on or off when the event was made and adjust the time based on that and the current user's setting at the time they are viewing the events.
It's something to consider... but no matter how it's implemented, it's almost certain to leave someone complaining. If you adjust for when an event author changes their dst setting, next people will want me to adjust automatically when the author changes their timezone, which may or may not be desirable - depending on why the user changed their timezone. Some users are not timezone savvy and will change their timezone when they notice that their times are off (instead of properly adjusting the dst setting). I've observed this behavior on my own forum periodically, which makes it difficult to manually run the script to turn DST on or off for everyone. Also if a user moves to a new timezone, should their event times move with them? Maybe yes, maybe no. It gets complicated quickly.
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by Gremlinn »

I was only thinking of the viewer's time compared to the time the event was recorded (not the author's current time). If a user doesn't adjust their DST, they have no right to complain (as far as I am concerned).

But, I agree. There would be a few things to take into consideration before a plan could be put together.

Quick thoughts:
save time as you are now.
record if author's (or boards?) DST is set
when viewing - compare viewer's DST to event's DST and adjust appropriately.

If the author changes timezones, it should not effect recorded events. They are considered as a viewer.
If a viewer changes timezones, (assuming they adjust their profiles), shouldn't make a difference in how things get calculated.

Of course, keep in mind, these are just quick thoughts :mrgreen:


Still, this is a very good calendar mod and thank you for creating it.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by MartectX »

It bugged me from the beginning that posts made during summer time werde shifted an hour when viewed in winter and vice versa. I came up with the Automatic DST modification not only to address the problem of changing the setting twice a year but the MOD also takes into account the appropriate DST option for every single date that is displayed. The PHP server settings were a godsend in this endeavour because otherwise I would have had to maintain a list of the correct settings of my own.

However, compatibility between the two MODs has been established; read about it here and here.
User avatar
urednik
Registered User
Posts: 105
Joined: Tue Jan 30, 2007 12:13 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by urednik »

Dear alightner,

I use this calendar more than 1 year (I think). Of course I also face with DST problems. Some users turn DST on, some not, so there was problems with hour. My board is local, and I was facing with problems...
I face also with diversion of 1 hour between board time and my computer time, but I don't find why...

So I rewrite code, to show only date and time is in mentioned in text ...

Please ask people, why they use calendar mode. I believe, that 95% of user use it to advertise some local events. And someone from Russia don't care about this time... Also when someone came to event it must also think about local time.

So my idea is:
- add to calendar input forum also place (maybe also in acp default place)
- the time, which is entered now is FIXED and related to this local place
- and output is: " Start at {start time and date} end {end time and date} at local time of {place}

Of course we must think also to other 5% of people, which have events worldwide.
This also can be done. Keep this form, but add to acp switch turn calculation of time ON/OFF.

This is just suggestion ...
User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by Gremlinn »

MartectX: sweeeet
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

MartectX wrote:It bugged me from the beginning that posts made during summer time werde shifted an hour when viewed in winter and vice versa. I came up with the Automatic DST modification not only to address the problem of changing the setting twice a year but the MOD also takes into account the appropriate DST option for every single date that is displayed. The PHP server settings were a godsend in this endeavour because otherwise I would have had to maintain a list of the correct settings of my own.

However, compatibility between the two MODs has been established; read about it here and here.
I haven't had time to install a test forum yet with the two mods... I'm still not convinced this is working for all cases. Your mod adjusts the date when saving for the server's DST time which I suggested as a possibility to Thyron... however, as I mentioned in that same post, I'm guessing there's still a problem with displaying the date/time since you are saving the date with respect to the server's dst setting on the day of the event, and yet the forum displays time via the server's current DST setting (not the DST setting for the server at the time you wish to display). Make sense?

I suspect your change is displaying the correct time on the day of the event, which is most important, but it needs to display the correct time days, weeks, or months before the event too (when perhaps the server has a different DST setting then it will have on the day of the event).

Again I haven't tested this... it's just a theory that I haven't had time to test yet.
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

Gremlinn wrote:Quick thoughts:
save time as you are now.
record if author's (or boards?) DST is set
when viewing - compare viewer's DST to event's DST and adjust appropriately.

If the author changes timezones, it should not effect recorded events. They are considered as a viewer.
If a viewer changes timezones, (assuming they adjust their profiles), shouldn't make a difference in how things get calculated.

Of course, keep in mind, these are just quick thoughts :mrgreen:


Still, this is a very good calendar mod and thank you for creating it.
Gremlinn, I think you're onto something here... this could help solve the problems (that I think still exist) with MartectX's work around. Again, these solutions won't work for every type of board... one of the early releases of the calendar used the server's DST setting when saving dates, and I got big complaints - not everyone hosts their site near it's users, but this might help a few people so it's worth persuing as a potential add-on to my mod, where people can choose whether or not they wish to install the extra parts that deal with the auto-dst mod.
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by MartectX »

My educated guess is that whenever you are saving a date you'll have to substitute

Code: Select all

- $user->dst
for

Code: Select all

- 3600 * date('I', $date_affected)
and whenever you want to display a date you'll have to substitute

Code: Select all

+ $user->dst
for

Code: Select all

+ ($user->data['user_dst'] == DST_ON || $user->data['user_dst'] == DST_AUTO && date('I', $date_affected) || $user->data['user_id'] == ANONYMOUS && $config['board_dst']) ? 3600 : 0
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

MartectX wrote:My educated guess is that whenever you are saving a date you'll have to substitute

Code: Select all

- $user->dst
for

Code: Select all

- 3600 * date('I', $date_affected)
and whenever you want to display a date you'll have to substitute

Code: Select all

+ $user->dst
for

Code: Select all

+ ($user->data['user_dst'] == DST_ON || $user->data['user_dst'] == DST_AUTO && date('I', $date_affected) || $user->data['user_id'] == ANONYMOUS && $config['board_dst']) ? 3600 : 0
This would work, if I were factoring the DST in to display a date, but that's not how it's done in most places... I use the forum's display date tools to convert the saved date out of forum's absolute time into the user's display time via the format_date function:

Code: Select all

					$event_output['START_TIME'] = $user->format_date($row['event_start_time']);
					$event_output['END_TIME'] = $user->format_date($row['event_end_time']);
That's why I originally told Thyron that to display the dates correctly with the Auto DST mod, it would be more than a few lines changed. Perhaps the auto dst mod could change the format_date function to display the forum's absolute time converted to the user's time with respect to the auto-dst setting on the date you're trying to display - that would help clear up this mess, as well as incorrect dates showed elsewhere on the forum.
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by MartectX »

alightner wrote:This would work, if I were factoring the DST in to display a date, but that's not how it's done in most places... I use the forum's display date tools to convert the saved date out of forum's absolute time into the user's display time via the format_date function
Automatic DST MOD already changes the format_date function to use server summer time settings if the user enabled automatic detection. :D
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

MartectX wrote:Automatic DST MOD already changes the format_date function to use server summer time settings if the user enabled automatic detection. :D
I must have missed that part... I didn't see any edits to the format_date function. Where was that change?
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by MartectX »

alightner wrote:I must have missed that part... I didn't see any edits to the format_date function. Where was that change?
OPEN includes/session.php

FIND

Code: Select all

		// Show date <= 1 hour ago as 'xx min ago'
ADD BEFORE

Code: Select all

		// This will determine the correct DST setting for every date, should a user wish for automatic detection
		$date_cache[$format]['zone_offset'] = ($this->data['user_dst'] == DST_AUTO) ? $this->timezone + date('I', $gmepoch) * 3600 : $this->timezone + $this->dst;
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

Well, in that case... this will probably work... there will need to be a few more tweaks here and there. I'll need to find every place in the calendar code that uses dst, and alter it appropriately to take into account the server's dst setting, but that's doable. Things like calculations of the graphical start and end time when in the "day view" mode etc will need to be tweaked.

Again I will not release this as part of the core calendar mod because I know of a few users in the beginning who'd complain, but releasing this as an add-on to my mod seems reasonable enough. Thanks for your help. :D
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by MartectX »

alightner wrote:Thanks for your help. :D
Thanks for you sanctioning Auto DST! ;)
alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Alpha] phpBB Calendar 0.0.8 (alightner)

Post by alightner »

I still don't have a test forum up and running with BOTH mods yet (so the following is provided with zero testing), but I think this covers all the required changes to add support for auto DST to the calendar mod.

NOTE these changes are not required to run the calendar - it's only here for those who want to run both mods together. Also note that these changes assume both the event creator and event viewer are using the auto dst setting... if any one user on your forum isn't using auto dst, the times displayed for that user would be "off". A user with auto dst disabled, would even see the wrong time when previewing their own new events (which could cause them to altar the start/end times to compensate for the difference - which would make the start/end time appear wrong to every other user who views it with auto dst on). To avoid this potential problem you may choose to set the user dst value to 2 (auto dst on) for all users, and remove the option to change the dst value in the UCP. Remember the auto dst mod won't work if your server is located in a part of the world that observes different DST start/end dates then your users (ie if you have a global forum, it's not recommended).

Required changes for calendar mod to add support for auto dst mod.

In calendarpost.php

Find:

Code: Select all

$event_start_date = gmmktime($start_hr, $start_mn, 0, $date['month_no'], $date['day'], $date['year'] ) - $user->timezone - $user->dst;
Replace with:

Code: Select all

$event_start_date = gmmktime($start_hr, $start_mn, 0, $date['month_no'], $date['day'], $date['year'] ) - $user->timezone - 3600 * date('I', gmmktime($start_hr, $start_mn, 0, $date['month_no'], $date['day'], $date['year']));

Find:

Code: Select all

$event_end_date = gmmktime($end_hr, $end_mn, 0, $end_m, $end_d, $end_y ) - $user->timezone - $user->dst;
Replace with:

Code: Select all

$event_end_date = gmmktime($end_hr, $end_mn, 0, $end_m, $end_d, $end_y ) - $user->timezone - 3600 * date('I', gmmktime($end_hr, $end_mn, 0, $end_m, $end_d, $end_y));

Find:

Code: Select all

$user_event_start = $event_data['event_start_time'] + $user->timezone + $user->dst;
Replace with:

Code: Select all

$user_event_start = $event_data['event_start_time'] + $user->timezone + 3600 * date('I', $event_data['event_start_time']);

Find:

Code: Select all

$user_event_end = $event_data['event_end_time'] + $user->timezone + $user->dst;
Replace with:

Code: Select all

$user_event_end = $event_data['event_end_time'] + $user->timezone + 3600 * date('I', $event_data['event_end_time']);

Find:

Code: Select all

$event_days_time = gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year']) - $user->timezone - $user->dst;
Replace with:

Code: Select all

$event_days_time = gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year']) - $user->timezone - 3600 * date('I', gmmktime(0, 0, 0, $eday['eday_month'], $eday['eday_day'], $eday['eday_year']));

Find:

Code: Select all

$event_start = $event_data['event_start_time'] + $user->timezone + $user->dst;
Replace with:

Code: Select all

$event_start = $event_data['event_start_time'] + $user->timezone + 3600 * date('I', $event_data['event_start_time']);

Find:

Code: Select all

$event_end = $event_data['event_end_time'] + $user->timezone + $user->dst;
Replace with:

Code: Select all

$event_end = $event_data['event_end_time'] + $user->timezone + 3600 * date('I', $event_data['event_end_time']);

in includes\functions_calendar.php:

Find:

Code: Select all

$test_hi_time = time() + $user->timezone + $user->dst;
Replace with:

Code: Select all

$test_hi_time = time() + $user->timezone + 3600 * date('I');

Find:

Code: Select all

$start_temp_date = gmmktime(0,0,0,$date['month_no'], $j, $date['year'])  - $user->timezone - $user->dst;
Replace with:

Code: Select all

$start_temp_date = gmmktime(0,0,0,$date['month_no'], $j, $date['year'])  - $user->timezone - 3600 * date('I', gmmktime(0,0,0,$date['month_no'], $j, $date['year']));

Find:

Code: Select all

$temp_date = time() + $user->timezone + $user->dst;
Replace with:

Code: Select all

$temp_date = time() + $user->timezone + 3600 * date('I');

Find:

Code: Select all

$test_hi_time = time() + $user->timezone + $user->dst;
Replace with:

Code: Select all

$test_hi_time = time() + $user->timezone + 3600 * date('I');

Find:

Code: Select all

$start_temp_date = gmmktime(0,0,0,$true_m, $true_j, $true_y)  - $user->timezone - $user->dst;
Replace with:

Code: Select all

$start_temp_date = gmmktime(0,0,0,$true_m, $true_j, $true_y)  - $user->timezone - 3600 * date('I', gmmktime(0,0,0,$true_m, $true_j, $true_y));

Find:

Code: Select all

$start_temp_date = gmmktime(0,0,0,$date['month_no'], $date['day'], $date['year'])  - $user->timezone - $user->dst;
Replace with:

Code: Select all

$start_temp_date = gmmktime(0,0,0,$date['month_no'], $date['day'], $date['year'])  - $user->timezone - 3600 * date('I', gmmktime(0,0,0,$date['month_no'], $date['day'], $date['year']));

Find:

Code: Select all

$event_start = $event_data['event_start_time'] + $user->timezone + $user->dst;
Replace with:

Code: Select all

$event_start = $event_data['event_start_time'] + $user->timezone + 3600 * date('I', $event_data['event_start_time']);

Find:

Code: Select all

$event_end = $event_data['event_end_time'] + $user->timezone + $user->dst;
Replace with:

Code: Select all

$event_end = $event_data['event_end_time'] + $user->timezone + 3600 * date('I', $event_data['event_end_time']);

Find:

Code: Select all

$event_days_time = gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year'])- $user->timezone - $user->dst;
Replace with:

Code: Select all

$event_days_time = gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year'])- $user->timezone - 3600 * date('I', gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year']));

Find:

Code: Select all

$row['event_start_time'] = gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year'])- $user->timezone - $user->dst;
Replace with:

Code: Select all

$row['event_start_time'] = gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year'])- $user->timezone - 3600 * date('I', gmmktime(0,0,0,$eday['eday_month'], $eday['eday_day'], $eday['eday_year']));

Find:

Code: Select all

$temp_now_time = time() + $user->timezone + $user->dst;
Replace with:

Code: Select all

$temp_now_time = time() + $user->timezone + 3600 * date('I');
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.
Locked

Return to “[3.0.x] Abandoned MODs”