Main menu

Forum


× Help Forum English

Major problem with calendar module

  • doorknob
  • Topic Author
  • New Member
  • New Member
More
10 years 4 months ago #6045 by doorknob
Major problem with calendar module was created by doorknob
I just spend two days debugging a T3 based template that kept reloading the page over and over only to discover that the problem is cause by some absurd mickey mouse coding in the calendar module that reloads the whole page just to set the value of an additional variable. AHHHHHHHHHHHHHHHHHHHHHH!

If anyone else has the same problem then you can replace all of the code in helper lines 1178-1198
if ($isSef == '1')
				{
				?>
					<script type="text/javascript">
					var d = new Date()
					var offset= -d.getTimezoneOffset()/60;
					location.href = "<?php echo $this_url; ?>?offset="+offset;
					</script>
				<?php
				}
				else
				{
				?>
					<script type="text/javascript">
					var d = new Date()
					var offset= -d.getTimezoneOffset()/60;
					location.href = "<?php echo $this_url; ?>&offset="+offset;
					</script>
				<?php
				}
with
if (date_default_timezone_get() == 'UTC')
				{
					$offset = 0; // No need to calculate offset, as default timezone is already UTC
				}
				else
				{
					$timezone = new DateTimeZone(date_default_timezone_get()); // Get timezone object
					$offsetSecs = $timezone->getOffset(new DateTime('2000-01-01 00:00:00')); // Offset in seconds
					$offset = round(abs($offsetSecs)/3600); // Offset in hours
				}
				JRequest::setVar('offset'. $offset);
line 1168 is also now obsolete.

In addition, I found a few other issues while I had the hood up.
1 The function get_timezone_offset() is embedded within another function. I've never seen that done before. I moved it to be a function of the class and changed the reference to it accordingly.
2 jQuery gets loaded directly rather than using a function call to tell Joomla to load it. That means that two copies get loaded instead of one. The iCagenda copy is an obsolete version which could lead to problems.
3 The jQuery coding doesn't use the recommended compatibility style so any other components using Mootools may conflict.
The following user(s) said Thank You: neuroscot

Please Log in or Create an account to join the conversation.

  • neuroscot
  • New Member
  • New Member
More
10 years 4 months ago #6046 by neuroscot
Replied by neuroscot on topic Major problem with calendar module
I think that is the problem I have come across - with v3.2.11 the calender module does not load and the page just sits trying to load.
Thanks

Please Log in or Create an account to join the conversation.

  • neuroscot
  • New Member
  • New Member
More
10 years 4 months ago #6048 by neuroscot
Replied by neuroscot on topic Major problem with calendar module
Just applied your code and it has cleared the problem/

Please Log in or Create an account to join the conversation.

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
10 years 4 months ago #6051 by Lyr!C
Replied by Lyr!C on topic Major problem with calendar module
@doorknob : you're right, it's really a bad code! My apologies...

I've found this code to get visitor time zone, and adapt it, but it was a very bad idea!!! :whistle:

So, currently, i'm workign to learn, and understand how to get visitor time zone with a script (because with php, you only get server side, and not client side)

Tomorrow, i will release 3.2.12 to fix it, with or without a working solution (if no working solution, no script!)

I'm learning everyday by mistakes!

So, i've got a good solution to get the timezone, just need now to set it to a var using Ajax (and it will be a new challenge...)
And this script (solid one found on github) provide timezone taking care of daylight and other many possible cases!

So, if a user with more skill than me wnat to help me, he is welcome !
;-)

Latest version : iCagenda 3.9.3
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Please Log in or Create an account to join the conversation.

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
10 years 4 months ago #6052 by Lyr!C
Replied by Lyr!C on topic Major problem with calendar module
To add some comments...

The above code replacement is not giving a working solution, and don't able to get visitor timezone.
It's not possible using only php (server side)

It's just removing the script, so of course no error anymore, but it is not adding anything to the purpose of getting visitor time zone.
In addition, I found a few other issues while I had the hood up.
1 The function get_timezone_offset() is embedded within another function. I've never seen that done before. I moved it to be a function of the class and changed the reference to it accordingly.
Yes, you're right.
What is your changes ?
2 jQuery gets loaded directly rather than using a function call to tell Joomla to load it. That means that two copies get loaded instead of one. The iCagenda copy is an obsolete version which could lead to problems.
I'm not agree. I doesn't load jQuery library 2 times, and iCagenda is not using an obsolete library. As you may be on Joomla 3, you may know that iCagenda is not loading a special jQUery library, but let Joomla core do it. (or i may have not understand what you want to speak about...)
B)
3 The jQuery coding doesn't use the recommended compatibility style so any other components using Mootools may conflict.
On a joomla 3 website, it's better not to use mootools, as it will be removed from the core joomla (it is in project)

In all cases, your help is welcome! :)

Latest version : iCagenda 3.9.3
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Please Log in or Create an account to join the conversation.

Moderators: Lyr!C
Time to create page: 0.194 seconds

Follow Us

Create your Joomla templates with Template Creator CK

acymailing logo new