Javascript and Kunena

From Kunena

(Redirected from Mootools 1.2.4 (Part 1))
Jump to: navigation, search

Contents

Introduction

Default Joomla 1.5.19+ Mootools plugins status
Default Joomla 1.5.19+ Mootools plugins status
From Joomla version 1.5.19[1], Joomla installs a new system plugin called "System - Mootools Upgrade". This plugin is installed in a disabled state the first time you login to a 1.5.19 site. Since the plugin is disabled, it has no impact on existing Joomla! 1.5.19 sites unless you choose to enable it.

When enabled, this plugin overrides the JHTMLBehavior and loads the new Mootools 1.2.4 Javascript files instead of the version 1.1 files. Compatibility with existing Mootools functionality is preserved using the Mootools compatibility layer.

As a general principle, if people require the expanded functionality of Mootools 1.2.4, then they should enable this plugin. If not, then they don't need to do anything. As far as Kunena is concerned, Kunena 1.6.0

K 1.6 requires this new Mootools 1.2.4 plugin to be enabled. It is also recommended that the older Mootools 1.2 plugin should be uninstalled or deactivated.

It does not matter if users specifically enable or disable the System - Mootools Upgrade plugin; as stated above, you only need to enable the plugin if you have other components that use the Mootools 1.2.4 Javascript library. Most sites will have this plugin disabled; this is normal. What K 1.6.0 does, however, is to automatically load the Mootools 1.2.4 library for pages that use the Kunena component.

This article discusses the theory and the background of Mootools 1.2.4. Another article goes on to give examples of the common causes of issues reported by users. Although this article refers to Mootools 1.2.4, the issues discussed are equally applicable to Mootools 1.2.5 and, going forward in Joomla 1.6, Mootools 1.3 and beyond. The Kunena development team will make every possible effort to ensure that Kunena will remain compatible with the standard Mootools Javascript library that is included as part of the most recent stable releases of Joomla.

Why does Kunena need Javascript?

A number of Kunena's features will not operate without Javascript. Here is a partial list of Kunena's features that depend on Javascript:

  • Message editing
    • Insert Smileys into messages
    • BBcode toolbar
    • Enlarge/Shrink message editing area
  • Quick Reply Button
  • User profile tabs
    • Who has thanked the user for their contributions; whom the user has thanked
    • Ban control
    • Personal preferences
  • Image view lightbox effect
  • Collapse/Expand buttons

Most of the Javascript for these features requires the presence of the System - Mootools Upgrade plugin (in other words Mootools 1.2.4). Although it's possible to run a forum without these features it certainly means that Kunena won't be as enjoyable.

What is Mootools: is it a component, plug-in or what? Where can I check if my Joomla has it installed, its version number and what may need to be done?

MooTools is a JavaScript framework which comes in a Javascript file usually named mootools.js[2]. The Mootools Javascript library is installed as a Joomla plugin. To check if, for example, your Joomla template is using a old version of mootools.js look for this code in your sites header

<script type="text/javascript" src="/Joomla/templates/YOUR-TEMPLATE-NAME/src/mootools.js"></script>

To check for the Mootools version go to the location of the Javascript file by following the src link from the script tag and look for this variable in the Javascript file

var MooTools={version:'1.11'};

The text between the single quotes is the Mootools version number.

Conflicts may arise between the Joomla extensions that you have installed and Mootools 1.2.4. To resolve these conflicts it is necessary to upgrade all these extensions that still use the old Mootools; there are a lot of these that require upgrading.

Mootools 1.2+ is the future of Joomla development. Most the reputable Joomla extension developers have already converted their code to be Mootools 1.2.4 compatible. If in any doubt, contact the developer(s) of the extensions that you are using on your Joomla website.

Enabling the Mootools Upgrade plugin

  1. Extensions » Plugin Manager
  2. Find System - Mootools Upgrade and check or uncheck to enable or deactivate it[3]

Does Kunena 1.6 require the Mootools Upgrade plugin?

Yes, Kunena 1.6 requires Mootools 1.2+[4] that is included with Joomla 1.5.19+ and 1.6.0+. Any template that still uses Mootools 1.1.x needs to be upgraded to Mootools 1.2.x.

What templates are Mootools 1.2+ compliant or work normally and without problems?

Rhuk_milkyway and JA_Purity, the two standard templates that are included with the Joomla installation kit are compliant with Mootools 1.2+. There are many others.

How to know if you have a Mootools issue

If you have a Mootools conflict with Kunena, look for the following symptoms:

  1. The performance of the forum on your website become unacceptably or noticeably slow
  2. The BBcode toolbar is not displayed and does not work
  3. You can't edit profiles
  4. Smileys don't work[5]
  5. The Kunena tabbed menu does not appear or does not work

Implications for Kunena users

Missing BBcode toolbar and smiley behaviour

Javascript-related problems show themselves in many different ways. If you are having issues with Mootools after you upgraded your existing Joomla install from pre-1.5.19 to that version (or any newer version of Joomla) it is most likely due to an incomplete Joomla upgrade. When you upgrade your Joomla version via any of the supported file upgrade steps you also have to make sure that you logout from your admin user and login again. Only then will Joomla perform additional upgrade steps like the installation of the MTupgrade plugin needed for the Mootools 1.2.4 support that Kunena 1.6 requires. It is unfortunate that the Joomla installation descriptions do not include this as a necessary step.

So if you are on Joomla 1.5.19 or newer and don't see "System - Mootools Upgrade" it is probably due to the fact that no new "admin login" has been performed since Joomla was upgraded.

You should not not install this plugin from any other sources, but make sure you log out your admin user and log back in. After that you should be able to find the "System - Mootools Upgrade" plugin in your Plugin Manager. Make sure it is enabled.

Mootool 1.2.x conflicts with certain Joomla templates

We've often found, in handling requests for support in this forum, that many problems have in the past been wholly attributed to the templates that users have chosen for their websites. The general advice is that, if the look and feel - the theme - of your website is more important than having a fully-featured forum component, like Kunena, then people may need to consider other options for hosting a forum. If, for you, having a fully-featured Kunena forum is important, then you may have to make other choices about the site template that you want to to use.

As Joomla progresses everything changes; templates and Javascript libraries are two prime examples. It's similar to when J! 1.0 stopped and J! 1.5 took over. Many of the older J! 1.0 site templates would not work with J! 1.5 without enabling legacy mode. This was to give J! 1.0 template designers the opportunity to update their old templates for the newer version of Joomla. "Legacy" mode gave people some breathing space.

Some template designers took advantage of this and some didn't. Those that didn't update their templates for Joomla 1.5 soon gained a bad reputation.

Many of the problems encountered by new users of Kunena 1.6 involve the choices that people have made in selecting the components for their website[6]. Many problems are entirely based on the site templates that people have chosen. Remember: "All that glisters is not gold". You may have chosen a template that looks great but, when you get into the "nuts and bolts", you may discover more than you bargained for. If the developers who make Joomla site templates want to protect their reputation they'll make things right.

Unfortunately there is no general advice we can give you on the world of Joomla templates other than to look for the ones that are either based on or support Mootools 1.2[7]. Any current jQuery template will also work.

In an ideal situation, Joomla template designers who leverage Mootools should not load their own copy but rely on the Joomla internal version that ships with 1.5.19+ and 1.6.0. If more developers followed that approach, Javascript conflicts would quickly become a problem of the past. The Kunena project believe in, and support, this Joomla concept and ultimately others who adhere to this approach in their work will come out on top.

The problems actually have less to do with what Javascript library people use but how it is implemented. Today many semiprofessionally-written extensions casually add their own versions of such libraries, without any regard for the consequences that different versions of these libraries, loaded at the same time, will cause errors both in their own software and in other developers' software.

The Kunena project has long endured the criticism that, because Kunena loaded its own version of jQuery, someone else's software loaded another version while another extension loaded another one and, in the end, it's a mess - a mess that could have been avoided if all developers followed a simple single standard: load the Joomla Javascript framework and have a single library take care of all the Javascript needs. In the early stages of Kunena the project team was undecided about using a "home-grown" of jQuery or using something else but was the early approach was just a misunderstanding of the technology. The project has learned much about Javascript libraries over the past years and has now decided to go "the Joomla way" - with Mootools 1.2. This decision was not based on one-vs.-the-other framework. It was based on the broader Joomla design strategy and ,after much discussion with the Mootools project team who were exceptionally helpful in making these important strategic decisions, about what is ultimately the best for the Joomla community.

Websites that load an old Mootools 1.1 library

When diagnosing Javascript problems we recommend the use of Firefox with the Firebug plugin installed and then examine what Javascript libraries are being loaded for your site.

For example, you have an error like "Browser not defined" in slimbox-min.js or slimbox.js it is a clear indication that mootools 1.2.x is not being loaded.

You can also look at the list of Javascript functions that have been loaded. In Firebug, go to Script and click on the drop down that lists the currently shown script file - you should see the list of all that are being loaded.

There are at least two possible version that get loaded:

../media/system/js/mootools.js

or

../plugins/system/mtupgrade/mootools.js

The first one is wrong; this is the Mootools 1.1 library. The second one is right; this is the Mootools 1.2.4 library.

If you are in any doubt, compare what Javascript libraries are being used on your site with the ones here at http://www.kunena.com

Why don't any Javascript function work for me, even those features available at the Kunena forum site?

Make sure that you have Javascript enabled for your web browser.

Further reading

  1. MooTools vs. Other Frameworks
  2. The great Mootools/Javascript conflict discussion
  3. Common causes of Mootools (Javascript library) issues and Kunena

References

  1. What is the Mootools 1.2.4 upgrade plugin?
  2. How to know If you have a mootools Conflict!
  3. See the video http://www.youtube.com/watch?v=p_NaBPIJHUg even though the website is in Turkish, it shows the missing BBcode toolbar problem and it shows how to enable the System - Mootools Upgrade plugin to fix that problem.
  4. K 1.6 Technical Requirements
  5. See the video http://www.youtube.com/watch?v=sd7upov3RJc even though the website is in Russian (and it's not actually a Kunena bug), it shows an example of the problem with inserting "smileys"
  6. Which came first? The template or the forum?
  7. Kunena + enable MooTools = problem for every second template? For general guidance, people should consider templates that were developed after the incorporation of Mootools 1.2.4 in Joomla 1.5.19 (i.e. after June 2010).
Personal tools