Main menu

Forum


× Help Forum English

Major problem with calendar module

  • doorknob
  • Autore della discussione
  • New Member
  • New Member
Di più
11 Anni 1 Settimana fa #6045 da doorknob
Major problem with calendar module è stato creato da 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.
Ringraziano per il messaggio: neuroscot

Si prega Accedi o Crea un account a partecipare alla conversazione.

  • neuroscot
  • New Member
  • New Member
Di più
11 Anni 1 Settimana fa #6046 da neuroscot
Risposta da neuroscot al 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

Si prega Accedi o Crea un account a partecipare alla conversazione.

  • neuroscot
  • New Member
  • New Member
Di più
11 Anni 1 Settimana fa #6048 da neuroscot
Risposta da neuroscot al topic Major problem with calendar module
Just applied your code and it has cleared the problem/

Si prega Accedi o Crea un account a partecipare alla conversazione.

  • Lyr!C
  • Avatar di Lyr!C
  • Administrator
  • Administrator
  • Lead Developer
Di più
11 Anni 1 Settimana fa #6051 da Lyr!C
Risposta da Lyr!C al 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.8
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 allegato:

Si prega Accedi o Crea un account a partecipare alla conversazione.

  • Lyr!C
  • Avatar di Lyr!C
  • Administrator
  • Administrator
  • Lead Developer
Di più
11 Anni 1 Settimana fa #6052 da Lyr!C
Risposta da Lyr!C al 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.8
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 allegato:

Si prega Accedi o Crea un account a partecipare alla conversazione.

Moderatori: Lyr!C
Tempo creazione pagina: 0.181 secondi

 

Follow Us

Create your Joomla templates with Template Creator CK

acymailing logo new