Page 1 of 1

most Gallery display functions not working in simplex theme

Posted: Sat Jan 09, 2016 12:48 am
by dlen
Hello folks,

the display functions not working are practically all except slimbox. The error message in Firefox is (in the case of fancybox): "fancybox is not a function".

The reason is twofold:
1. jQuery is loaded twice, once by the gallery module in the page head, and once more by the simplex theme at the page bottom.
2. at least some gallery-jQuery-plugins do not work with modern jQuery without the "migrate"-option.

So to make the thing work,

either deactivate the jQuery loading by the simplex theme
or move it to the head, while activating the loading of the "migrate"-option again as suggested by the simplex-theme-author, and deactivating the jQuery loading in the Gallery template.

I personally would like to see both the theme and the module altered in such a way, that such tweaks ar no more necessary, because they make cmsms cumbersome to work with, which is a pity. As my knowledge is at most intermediate, i would like to spark a discussion about the steps to take. I filed a bug report in the Gallery bug list a while ago: http://dev.cmsmadesimple.org/bug/view/10637

Re: most Gallery display functions not working in simplex th

Posted: Sat Jan 09, 2016 2:30 pm
by Jos
Thank you dlen,

The jQuery thing is not something a module-developer can help you with, so I guess you filed your bugreport at the wrong place.

Fancybox 1.x series is end-of-life. There is Fancybox 2.x but that one is licensed under Creative Commons Attribution-NonCommercial 3.0 license, which means you need to pay a fee to use fancyBox for commercial websites. Therefore I think it is not appropriate to include that version in Gallery, because someone could easily not notice that restriction.

Guess I just need to exclude Fancybox 1.x from Gallery.

Re: most Gallery display functions not working in simplex th

Posted: Sat Jan 09, 2016 9:54 pm
by dlen
Thanks, Jos, for your reply.

apart from fancybox, the problem with loading jQuery twice seems to me a more profound one, affecting many modules.

Is there a convention in CMSMS, how the loading of jQuery, and the initialisation of modules that use jQuery, should be organized?

Re: most Gallery display functions not working in simplex th

Posted: Sat Jan 09, 2016 10:44 pm
by Jos
As far as I know there is no convention.
The usual method is that modules don't do this at all, but the user should add the call to the jquery library manualy in a template, global metadata field, or page metadata. The same for any other javascript.

At the time the Gallery module was first released, jquery wasn't that commonly used. My idea was that it would help the user to insert javascript and css automatically, so the user can easily switch to another gallery-template without much fuzz.

I haven't found a way to check serverside that jquery is allready included. So my basic idea is that it's easier for a user to delete a row from the template than to add one.

In addition, I have been busy this evening to make it possible to insert the javascript to the end of the body element, in stead of the head. The next release will have an option for that, which you can set for each gallery-template (In fact, the latest Lightbox 2.8.2 will need that, otherwise it won't work at all)

Re: most Gallery display functions not working in simplex th

Posted: Sun Jan 10, 2016 12:22 am
by Jo Morg
dlen wrote:Is there a convention in CMSMS, how the loading of jQuery, and the initialisation of modules that use jQuery, should be organized?
Jos wrote:As far as I know there is no convention.
The usual method is that modules don't do this at all, but the user should add the call to the jquery library manualy in a template, global metadata field, or page metadata. The same for any other javascript.
It is a matter of flexibility: CMSMS has a tag that allows a frontend developer to include JQuery on a template. It's not mandatory, you can use it or not at your discretion. Module developers can include their own libraries and even use different ones than JQuery. It's each developer's responsibility to provide enough documentation on the use of the module, but it's also the user's (read frontend developer's and/or web developer's) responsibility to actually read it. Some modules may not have enough documentation (it's hard to document a module and some developers do just the minimum), but there are no conventions when the use of a convention may limit the flexibility of the whole system.
The templates provided are samples that have the sole purpose of documenting by example on one side, and of giving a startup for beginners to build up on on the other. They are not perfect, and you should not expect them to work with all and every module as much as you shouldn't expect every module to work with the sample templates out of the box, although every effort is made in that sense from the Dev Team and the developers of most modules (and Jos amongst them).

Re: most Gallery display functions not working in simplex th

Posted: Mon Jan 11, 2016 7:27 pm
by dlen
Thanks both for your answers.

As i see now, the info about jquery beeing loaded twice is existing on http://wiki.cmsms.nl/index.php/Gallery.

Sometimes testing it out for 2 hours can save 20 minutes of reading documentation ;-).

Re: most Gallery display functions not working in simplex th

Posted: Mon Jan 11, 2016 7:31 pm
by Rolf