BUGFIX: tree selector base URL calculation wrong when field is nested (from r99739)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105523 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-05-25 02:57:22 +00:00
parent 54ecf20f68
commit 7f2d888a40

View File

@ -60,7 +60,14 @@ TreeDropdownField.prototype = {
// Build a URL from the field's base URL and the given sub URL
buildURL: function(subURL) {
var baseURL = jQuery(this).attr('href');
if (!baseURL) baseURL = this.ownerForm().action + '/field/' + this.getName() + '/';
if (!baseURL) {
// Occurs if treedropdown has no form e.g. treefields in widget areas.
baseURL = this.ownerForm().action + '/field/' + this.getName() + '/';
var baseTags = document.getElementsByTagName('base');
var base = (baseTags) ? baseTags[0].href : '';
if (base == baseURL.substring(0, base.length))
baseURL = baseURL.substring(base.length);
}
var subHasQuerystring = subURL.match(/\?/);
if(baseURL.match(/^(.*)\?(.*)$/)) {