• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Form plugins mixing up

Clues are surfacing...

I'm getting some clues about this issue... /administrator/components/com_fabrik/views/pluginmanager.js within addPlugin: function (plugin, c) line 170 or so. "c" is not updating properly. On line 200 this.pluginTotal ++ is not updating fast enough, so when new plugin requests are sent c hasn't updated, so it passes c as say 2 twice to the plugin request.

So, the Ajax requests takes a moment to send and while it's doing the request, the next plugin is being processed before this.pluginTotal moves up to the next number.

I've sped it up by moving this.pluginTotal ++ up like so:
Code:
addPlugin: function (plugin, c) {
        c = typeOf(c) === 'number' ? c : this.pluginTotal;
        this.pluginTotal ++;

Also, I've used the pluginmanager-min.js version which seems to speed it up. (How do you get that one to run by default?) I have fabrikdebug turned off.

So, this has certainly helped. Instead of botching up the plugins every few page loads, it botches them only once every 10 or so page loads.

How do we get this.pluginTotal to move up properly?
 
Here's a view of my access log. In the pluginmanager.js, I changed the request to a "get" so I could see what's going on in the access log. Below are two sets. The first one is one that worked. The second one is one that didn't work. You'll notice that there are four plugins. On the botched batch, the second c=1 did not process.


63.224.42.234 - - [12/Jan/2013:13:57:47 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=php&c=0&id=2
63.224.42.234 - - [12/Jan/2013:13:57:48 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=email&c=1&id=2
63.224.42.234 - - [12/Jan/2013:13:57:49 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=2&id=2
63.224.42.234 - - [12/Jan/2013:13:57:49 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=3&id=2


63.224.42.234 - - [12/Jan/2013:13:58:01 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=php&c=0&id=2
63.224.42.234 - - [12/Jan/2013:13:58:03 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=2&id=2
63.224.42.234 - - [12/Jan/2013:13:58:03 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=3&id=2
 
Here's another example. In this case. "c" is correct. It counts from 0,1,2,3. But note that the request calls came back at different times: So, the plugins were mixed up. The email plugin came back last instead of second.

lost email and last redirect
63.224.42.234 - - [12/Jan/2013:14:29:04 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=php&c=0&id=2
63.224.42.234 - - [12/Jan/2013:14:29:05 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=1&id=2
63.224.42.234 - - [12/Jan/2013:14:29:06 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=2&id=2
63.224.42.234 - - [12/Jan/2013:14:29:07 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=email&c=3&id=2
 
I should probably quit sending you examples. But I think this one sheds some light. In this case all four requests came back. But this time email was sent third. "c" is correct, but c=2 shouldn't have been assigned to email. Email is second in the list. So for email it should have been send with c=1. This means that the topTotal from addTop isn't processing it reliably ( in order).

email and first redirect wrong
63.224.42.234 - - [12/Jan/2013:14:53:32 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=php&c=0&id=2
63.224.42.234 - - [12/Jan/2013:14:53:33 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=1&id=2
63.224.42.234 - - [12/Jan/2013:14:53:33 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=email&c=2&id=2
63.224.42.234 - - [12/Jan/2013:14:53:34 -0800] "GET /administrator/index.php?option=com_fabrik&view=plugin&format=raw&type=form&plugin=redirect&c=3&id=2
 
I think this is a solution. It hasn't failed yet.

from pluginmanager.js
Code:
addTop: function (plugin) {
    
        if (typeOf(plugin) === 'string') {
            published = 1;
            plugin = plugin ? plugin : '';
        } else {
            // Validation plugins 
            published = plugin ? plugin.published : 1;
            plugin = plugin ? plugin.plugin : '';
        }
        var div = new Element('div.actionContainer.panel');
        var toggler = new Element('h3.title.pane-toggler').adopt(new Element('a', {'href': '#'}).adopt(new Element('span').set('text', plugin)));
            
        div.adopt(toggler);
        div.inject(document.id('plugins'));
        var append = document.id('plugins').getElements('.actionContainer').getLast();
        // Ajax request to load the first part of the plugin form (do[plugin] in, on)
        
        this.topTotal ++;
        var tt_temp = this.topTotal;//we put the topTotal in a temp variable
        var request = new Request.HTML({
            url: 'index.php',
            data: {
                'option': 'com_fabrik',
                'view': 'plugin',
                'task': 'top',
                'format': 'raw',
                'type': this.type,
                'plugin': plugin,
                'plugin_published': published,
                'c': tt_temp,
                'id': this.id
            },
            append: append,
            onSuccess: function (res) {
                
                if (plugin !== '') {
//then we send the tt_temp variable toptotal with the addplugin, so just in case they are processed at different rates, they don't mix up.
                    this.addPlugin(plugin, tt_temp);
                    
                }
                this.accordion.addSection(toggler, div.getElement('.pane-slider'));
            }.bind(this),
            onFailure: function (xhr) {
                console.log('fail', xhr);
                
            },
            onException: function (headerName, value) {
                console.log('excetiprion', headerName, value);
            }
        });
        Fabrik.requestQueue.add(request);
    }
 
The only thing I'm afraid of is that tt_temp variable. I don't want that to change...maybe I'm just paranoid now. Is there a way to get "c" from onSuccess: function (res).

Last thing in regards to js files. How do I get the minimized ones to be sent. It seems that the full js files are being sent even when I have fabrikdebug set to no/off.
 
My code is now breaking the validation plugin.

What needs to happen is to be sure the "c" doesn't mix up, when multiple plugins are there.
So if you have, like in my example:
addTop Request
0 php
1 email
2 redirect
3 redirect

Besure that the the addPlugin request fires in the same sequence:
0 php
1 email
2 redirect
3 redirect

Because mine are sometimes firing differently, like:
0 php
1 redirect
2 redirect
3 email



I also think there's an additional issue:
Sometimes addTop sends 4 requests
0 php
1 redirect
2 redirect
3 email

But then addPlugin sends only 3 requests:
0 php
2 redirect
3 redirect
...which may have something to do with how "c" and pluginsTotal increases.

And then there's the differences with the validation plugins...which I don't understand yet and can't dig into tonight.
 
Just my two 'penneth here - it's happened to me too on the latest github. In my case if has two php plugins followed by a redirect - when I added another php plugin the sky fell in - I removed it and removed the redirect then added the third php plugin and all was well - so personally I think it's something to do with having a redirect in there?

Anyway I hope that helps track it down.

Regards, Mark.
 
This seems to be working for all three plugin types that I know of: List, Form and element validations. What am I missing?
\administrator\components\com_fabrik\views\pluginmanager.js
Code:
addTop: function (plugin) {
        if (typeOf(plugin) === 'string') {
            published = 1;
            plugin = plugin ? plugin : '';
        } else {
            // Validation plugins 
            published = plugin ? plugin.published : 1;
            plugin = plugin ? plugin.plugin : '';
        }
        var div = new Element('div.actionContainer.panel');
        var toggler = new Element('h3.title.pane-toggler').adopt(new Element('a', {'href': '#'}).adopt(new Element('span').set('text', plugin)));
            
        div.adopt(toggler);
        div.inject(document.id('plugins'));
        var append = document.id('plugins').getElements('.actionContainer').getLast();
        // Ajax request to load the first part of the plugin form (do[plugin] in, on)
        var tt_temp = this.topTotal; //added temp variable
        var request = new Request.HTML({
            url: 'index.php',
            data: {
                'option': 'com_fabrik',
                'view': 'plugin',
                'task': 'top',
                'format': 'raw',
                'type': this.type,
                'plugin': plugin,
                'plugin_published': published,
                'c': this.topTotal,
                'id': this.id
            },
            append: append,
            onSuccess: function (res) {
                
                if (plugin !== '') {
                    this.addPlugin(plugin, tt_temp+1); //sent temp variable as c to addPlugin, so they are aligned properly
                }
                this.accordion.addSection(toggler, div.getElement('.pane-slider'));
            }.bind(this),
            onFailure: function (xhr) {
                console.log('fail', xhr);
            },
            onException: function (headerName, value) {
                console.log('excetiprion', headerName, value);
            }
        });
        this.topTotal ++;
        Fabrik.requestQueue.add(request);
    },
 
Best bet is if you run this change for a few more days, and confirm that it has no unexpected side effects. Then I'll run it for a few days. Then we'll apply it to github.

Awesome job of tracking that one down, btw. Thanks!

-- hugh
 
thanks Davez, that looks like a good solution to me, I'll run that locally for a bit before committing

-Rob
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top