Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
6.x-1.x-dev
Component:
User interface
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Mar 2011 at 09:49 UTC
Updated:
10 Oct 2011 at 18:57 UTC
On a multilingual site, when I execute a bulk operation on a selection of rows, while displaying the site in a non-default language, the next screen (usually confirmation screen) switches to the site default language.
This is quite annoying, as I want to use VBO views for a content admin role for a person not equally proficient in all languages, and would definitely expect all steps to be executed preserving currently selected language.
I assume path prefixes are not correctly appended, though the URL does not change (ajax call?).
Thanks in advance!
Comments
Comment #1
marktheshark commentedComment #2
marktheshark commentedAny input on this please?
Comment #3
Architeck commentedYour not alone, I am experiencing a very similar issue:
When I apply VBO actions the form action does not include the language prefix and in my case throws a 403 error. If I manually edit the action with firebug to include the prefix, the actions are successfully executed.
I have been trying to track down the right combination of translation (language prefix handling) and vbo settings, but thus far have not come up with a solution.
Using:
Views - 6.x-2.12
Views Bulk Operations - 6.x-1.10
Internationalization - 6.x-1.8
Comment #4
marktheshark commentedHaven't looked at the code, but perhaps the form action element is not wrapped in an l() function that would automatically take i18n into account?
Comment #5
jaxxed commentedThe VBO modules doesn't properly handle url rendering in it's core. here is a description of the problem, the relevant code, and a fix (at the bottom) that has been tested in one environment only.
Please see hook_form in views_bulk_operations.module:184
Here are the relevant lines: ~199
The module is attempting to bypass the current url, by pulling the Drupal URL parameter directly. This fails in any rewritten url cases, including localization. This is considered bad form in Drupal, but is sometimes implemented in cases where Drupal modified urls prevent access to actual menu routes, but this was more of a Drupal 5 technique than 6. Form are in general not a case where pulling the 'q' variable is necessary.
That being said, there amy be a reason why the VBO devs have pulled the GET[q] directly.
The drupal_add_js adds the key url=$_GET['url'] to the Javscript Drupal.settings array, which is then used to pick a target for ahah.ajax form submits.
Once could use the Drupal url() function to include the rewrites with a small change:
DON'T USE THIS CODE, FOR REASONS DESCRIBED BELOW
When I implemented this, I found that the language specific prefix was now included in my forms, however that being said, the forms redirected to an absolute url becuase url puts a leading slash on the url, while the form creation script also adds a leading slash. This lead to the form submitting to an invalid absolute url (http://en/view/display) instead of a relative url (http://site.root/en/view/display.) To fix this I took of the leading slash with a substr().
THIS CODE WORKED FOR ME, BUT TEST IT IN YOUR ENVIRONMENT FIRST
This has been tested on a single site that uses a root url (no subfolders.) If someone is willing to test it on a site that uses a folder path in the url, then I would consider writing this as a module patch and submitting it to the module developers.
The overalll patch is something like:
Comment #6
jaxxed commentedUpgrading priority: this issue effectively makes all VBO operations on multilingual sites inoperative. Localization is a core feature, even though it's not enabled by default.
Module Developer: Please consider investigating the fix I've included above (Comment: #5) I've tested the fix on one or two sites, but am unsure why the url function wasn't used in the first place.
Comment #7
infojunkieThanks for the analysis. I am currently working on a major fix to VBO's selection mechanism which involves getting rid of the code above. I hope to release this during this week.
Comment #8
infojunkieI committed the major fix mentioned above. Please test your scenario again and let me know if it works.
Comment #9
marktheshark commentedI will try to test this on my local site instance tomorrow and provide feedback. Thanks for your effort!
Comment #10
marktheshark commentedInstalled latest 6.x-1.x-dev version, and flushed Views cache. Language switch is not observed anymore. VBO views retain selected language.
Will this be ported to the Recommended Version?
Thanks again everybody for your support! :-)
Comment #11
infojunkieYes, this fix will be included in next release. Thanks for your feedback!
Comment #13
tobiberlinHi,
re-open this issue: I tried it and found a problem when I run my site within a subfolder:
Let's say my site runs on http://www.mysite.com/subfolder/ where "subfolder" is the root directory of my drupal installation. Then when I try to use VBO on http://www.mysite.com/subfolder/vbo and start an action I am lead to http://www.mysite.com/subfolder/subfolder/vbo when I applied this patch to my vbo module (version 6.10).
Best,
Tobias
Comment #14
infojunkie@tobiberlin: are you using the latest dev?
Comment #15
jaxxed commented@tobeiberlin: do you still have this issue? is it with the latest code?
If so, then can you please revert the above patch to see if it is the cause of the problem. It's been some time since I wrote it, so I don't remember the whole code base for it. It seems to me that the 'url' function should be able to handle subfolder sites.
@infojunkie: do you think that the patch caused the problem?
Comment #16
infojunkie@jaxxed: I didn't use your modification because the JavaScript code that computes the form action had changed in the mean time.
Comment #17
bojanz commented#13 appears to be using a non-supported patch, instead of a version (6.x-1.11, 6.x-1.x) which has a better fix included.