23478 Posts in 18941 Topics by 2878 members
|Go to End|
28 July 2009 at 5:08am Last edited: 28 July 2009 5:08am
I've finished translating our entire site into swedish - all in draft mode. (saving lots of time with the excellent CMS Batch Action module found here http://www.silverstripe.org/customising-the-cms/show/262215)
On my dev site it gives a 'Undefined error', looking like this in my log:
[27-Jul-2009 06:52:18] Warning at D:\Wamp Websites\cms\code\CMSBatchAction.php line 42: Invalid argument supplied for foreach() (http://localhost/admin/batchactions/publish)
If I use the batch action on the default language (en_US) it works fine.
Have someone else experienced this? What can I do? I'd rather not publish ~200 pages manually...
16 June 2011 at 8:22pm
The problem is that the default language is being selected /not the current language and filtering out all the pages you want to update...
silverstripe-cms/code/CMSMain.php Line 91
$this->Locale = Translatable::default_locale();
$this->Locale = Translatable::choose_site_locale();
16 October 2011 at 12:21pm
That doesn't solve the problem
The problem is that regular admin page, uses "locale" $_GET param to determine what locale we are currently in, but ajax requests for batch actions don't have that parameter set!
So when we are not working in primary locale, ajax url for batch action looks something like:
This one for example looks if we can delete pages from "Live", BUT there is no GET locale param set!!
It should look like:
Because of that for DataObject::get() methods in BatchAction handler we get queries like:
SELECT ... WHERE ... SiteTree.ID IN (184) AND Locale = 'en_US' <-- DEFAULT LOCALE!!!
choose_site_locale() method uses $_GET param to determine the locale, BUT as i said before its no set un current ajax url request.
So now, we have to somehow pass locale parameter into ajax requests...
18 October 2011 at 3:51am
This was bugging me as well, so I went adding locales almost everywhere, finally narrowing it down to two files, two lines of code, and now it seems to work for me.
find the following form: <form class="actionparams" style="border:0" id="batchactions_options" action=""> and add a new hidden field like so:
<input type="hidden" name="locale" id='batchactions_options_locale' value="$Locale" />
Then do a ?flush=1
find the folowing code (line 461 or thereabouts)
var applicablePagesURL = $('choose_batch_action').value + '/applicablepages?csvIDs=' + ids.join(',');
and add the locale like this:
var applicablePagesURL = $('choose_batch_action').value + '/applicablepages?csvIDs=' + ids.join(',') + "&locale=" + $('batchactions_options_locale').value;
Please let me know if you find any errors in this...
20 April 2012 at 3:04am
The latest comment from martimiz did work for me! It should be added to the silverstripe source!
|Go to Top|