joomla3.3.6 and ajax interface

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
jschmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Wed Oct 08, 2008 7:14 am

joomla3.3.6 and ajax interface

Post by jschmi » Wed Jan 28, 2015 4:43 pm

hi,

I've developed a module using joomla's core ajax interface. It worked fine until I changed the modules's menu asssignment from "all" to "only selected" in order to show the module not on every page.
With this my ajax interface (the javascript to trigger module) now gets an error404 (when calling script-url from browser I get:
"LogicException: Module mod_my_module is not published, you do not have access to it, or it's not assigned to the current menu item"
.
I've checked component com_ajax (ajax.php). There I found that modulehelper
$moduleObject = JModuleHelper::getModule('mod_' . $module, null);
returns id="0" in case that only selected menu-items have been assigned to module.

Is this a bug or a limitation for modules using joomla's ajax interface?

jschmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Wed Oct 08, 2008 7:14 am

Re: joomla3.3.6 and ajax interface

Post by jschmi » Thu Jan 29, 2015 10:21 am

hi all,

I've found the problem - it is a bug! SQL-query in method "load" of JModuleHelper is not correct and is causing the problem.
Line 360 is coded:
-->where('(mm.menuid = ' . (int) $Itemid . ' OR mm.menuid <= 0)');
but it should read:
-->where('(mm.menuid = ' . (int) $Itemid . ' OR mm.menuid >= 0)');
Hopefully this bug gets corrected ASAP.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17434
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: joomla3.3.6 and ajax interface

Post by toivo » Thu Jan 29, 2015 12:16 pm

Well spotted.
Hopefully this bug gets corrected ASAP.
It should if someone has reported it. It does not come up if you search for the word 'ajax' in the list of Joomla issues at http://issues.joomla.org/

The instructions how to file bug reports are here:
https://docs.joomla.org/Filing_bugs_and_issues
Toivo Talikka, Global Moderator

jschmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Wed Oct 08, 2008 7:14 am

Re: joomla3.3.6 and ajax interface

Post by jschmi » Thu Jan 29, 2015 1:40 pm

hi,

thanks for your info. I've written an issue at http://issues.joomla.org/.
Actually the problem is not only with ajax. it probably may come up as well with any extension using JModuleHelper::getModule.

jschmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Wed Oct 08, 2008 7:14 am

Re: joomla3.3.6 and ajax interface

Post by jschmi » Thu Jan 29, 2015 3:02 pm

hi,

I did some more testing and found that sql-statement should be:
-->where('(mm.menuid = ' . (int) $Itemid . ' OR mm.menuid = 0)');
otherwise all your published modules will be shown on all pages.
Fixed this problem temporarily in ajax.php with

Code: Select all

if (JModuleHelper::isEnabled('mod_' . $module))
instead of original if-clause.
(closed issue at github)

Having tested with various scenarios, I think com_ajax needs some more rework esp. in the area of modules using ajax (think of a case where a user want to have more than one version of same module (with different parameters) at same page.

jschmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Wed Oct 08, 2008 7:14 am

Re: joomla3.3.6 and ajax interface

Post by jschmi » Sat Jan 31, 2015 10:43 am


User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17434
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: joomla3.3.6 and ajax interface

Post by toivo » Sat Jan 31, 2015 1:14 pm

That was a good contribution, some others can now find the answer in a similar situation.
Toivo Talikka, Global Moderator


Locked

Return to “Extensions for Joomla! 3.x”