Hi guys!
How to reproduce:
Create a view with at least an exposed taxonomy filter ('Content: Has taxonomy term').
Configure the exposed form settings to expose also the "reset button" ( or not ;-).
Select one term and hit "Apply".
By going to the actual url of the view (not the editing page) everything work as expected but not in the preview, where the results are the same (like if the filtes weren't be applied).
Trying to address the issue i realize that ctools_object_cache_get is going be to called (view_ui.module line 265 approx.) and that function has been marked as Deprecated, also that in views_ui_preview (admin.inc line 87 approx.) the $exposed_input variable (conceptually the user's input on the filter ) is build from $exposed_input = $_POST and it's empty also when a filter option is selected, is this the normal behavior?
Comments
Comment #1
dawehnerI was so sure, that i filled an issue already, but you provided some helpful informations.
Comment #2
neoglez CreditAttribution: neoglez commentedI'm gonna try to deal with this...(or souldn't i? ;-)
Comment #3
dawehnerIf you manage to fix the issue, it would be cool.
This worked one time, you could use git bisect with the commit of the new ui as start.
Comment #4
neoglez CreditAttribution: neoglez commentedTested with other Filters (e.g. Content: Published)--> the same situation.
Comment #5
neoglez CreditAttribution: neoglez commentedWell, this issues are caused by the separation of the forms in the preview, one containig the checkbox 'Auto preview' and the textbox 'Preview with contextual filters' (FAPI ID views_ui_edit_form) and the otherone the exposed filters + preview results (FAPI ID views_ui_edit_form), there also some comments and @todo in the code related to this.
All exposed input is gadered in admin.inc
First of all it's clear that is not gonna work for non-JS users since the form containig the exposed filters has the method set to get (views_plugin_exposed_form.inc line 117), $_POST is empty when submiting the form, this no happening in the 'normal page' (not preview) becouse the the request is handle by a different callback.
On the other hand the approach to JS-users also fails becouse when clicking the 'Apply' or 'Reset' button the click on the 'Update preview' button is triggered (via ajax) submiting the form views_ui_edit_form and not views_ui_edit_form, wich contains the exposed filters, the 'normal page' works here becouse differents js files are included depending on the situatuion (ajax.js for views ui in contrast to ajax_view.js in the normal page), this is the good news ;-)
Well, here is a solution althoug i think a more consistent approach could be developed.
Comment #6
dawehnerCan you please always create a .patch file? It's much easier to test it and perhaps with dreditor also to review.
Comment #7
neoglez CreditAttribution: neoglez commentedDone!
Comment #8
neoglez CreditAttribution: neoglez commentedComment #9
neoglez CreditAttribution: neoglez commentedFixing an undefined index in the first run.
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commented#9 violates code style with inconsistent tabbing.
Comment #11
jpstrikesback CreditAttribution: jpstrikesback commentedThanks neoglez! :)
Rerolled to latest dev and added one fix - func_get_Args() doesn't like being a parameter to another function prior to 5.3 - quote below:
Because this function depends on the current scope to determine parameter details, it cannot be used as a function parameter in versions prior to 5.3.0. If this value must be passed, the results should be assigned to a variable, and that variable should be passed.
Comment #12
dawehnerDrupal uses 2 spaces here.
What is the reason to remove it?
A comment would be cool here
!isset is also empty, so why is here a check for both?
Powered by Dreditor.
Comment #13
jpstrikesback CreditAttribution: jpstrikesback commentedAs i didn't create the original I can't answer all too quick but i'll try as time permits:
1) patch attached
2) seems to be cruft from an old approach, removed entirely in attached patch (for some history see commit 660c523b0eb0768034f336171af321873fc52cce)
3) Neoglez?
4) Neoglez?
Cheers
JP
Comment #14
neoglez CreditAttribution: neoglez commentedLet's see, i was testing this patch (#9) and it doesn't work pretty well (apart of the formating thing) -and for you?
Before let's try to agree in the logic (in a simplified flow):
There are two FORMS: one $_POST (views_ui_edit_form) and one $_GET (views_ui_edit_form)
What happens actually is that arguments are appended to the url of the $_GET form.
Question:
Shoud we nice degradate when no-JS-preview? I would say yes. At the momment views only degradate (but not so nice e.g. only the preview is rendered but not the view-edit-form)
OK.
Now the information comes separately, there is no need to do it becouse those values are beeing posted only when clicking 'update preview' and in this case we want them (why shoudn't we?), if 'Apply' is clicked then this values are not posted (why attempt to remove them if they don't exist).
What about something like:
Good catch!
Thanks guys for the review!!
Comment #15
neoglez CreditAttribution: neoglez commented@jpstrikesback, we're almost there ;-)
Did you try the patch and realize 2. of #14??
Thanks!
Comment #16
merlinofchaos CreditAttribution: merlinofchaos commentedOk, restarted this from scratch, now that I understand.
Also, the way we reset was broken, so I had to fix it to get the reset button to work as well. This patch preserves interaction with summary arguments as well, unlike the earlier patches.
I think this is ready to go as is but I would like a couple of independent tests.
Comment #17
merlinofchaos CreditAttribution: merlinofchaos commentedThis patch actually ends up demonstrating that reset doesn't work with use_ajax, so that probably has to be fixed as well, but it does not need to be fixed as part of this patch.
Comment #18
neoglez CreditAttribution: neoglez commentedPatch #16 seems to be working very well (NOT the reset, we would have to file an issue report for this one) and compliant with the logic in #14.
It also degradates (like before said NOT nice) for non-JS users.
I say we commit it.
Comment #19
neoglez CreditAttribution: neoglez commented;-)
Comment #20
jpstrikesback CreditAttribution: jpstrikesback commentedTested, works, reset get's all funny as expected (once I add multiple exposed filters).
One thing I noticed (that may be to do with the filter handler I'm trying to build) was that when there was a sql error dependencies stopped working...but that would be something separate I think...
Comment #21
merlinofchaos CreditAttribution: merlinofchaos commentedThanks!
Committed the patch. We need a separate issue for the reset button. Can you post one with what you saw with reset? i'm not sure what all the problems are going to be, as I didn't delve too deeply. I made sure the very basic reset routine worked and that was it.
Comment #22
neoglez CreditAttribution: neoglez commentedCrossposting:
#1188532: Reset button not working in Preview