mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-06-26 06:29:31 +02:00
e17ecfbdee
ENHANCEMENT Allowing to select a subsite explicitly through admin-URLs, e.g. /admin/show/22/?SubsiteID=2
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
SubsitesTreeDropdownField = Class.extend('TreeDropdownField');
|
|
SubsitesTreeDropdownField.prototype = {
|
|
|
|
//subsiteID: null,
|
|
|
|
ajaxGetTree: function(after) {
|
|
var ajaxURL = this.helperURLBase() + 'gettree?forceValues=' + this.inputTag.value;
|
|
|
|
// Customized: Append subsiteid (evaluated in SubsitesVirtualPage.php)
|
|
if(this.subsiteID) ajaxURL += '&' + this.id + '_SubsiteID=' + this.subsiteID;
|
|
|
|
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
|
new Ajax.Request(ajaxURL, {
|
|
method : 'get',
|
|
onSuccess : after,
|
|
onFailure : function(response) { errorMessage("Error getting data", response); }
|
|
})
|
|
},
|
|
|
|
ajaxExpansion: function() {
|
|
this.addNodeClass('loading');
|
|
var ul = this.treeNodeHolder();
|
|
ul.innerHTML = ss.i18n._t('LOADING');
|
|
|
|
var ajaxURL = this.options.dropdownField.helperURLBase() + 'getsubtree?&SubtreeRootID=' + this.getIdx();
|
|
|
|
// Customized: Append subsiteid (evaluated in SubsitesVirtualPage.php)
|
|
if(this.subsiteID) ajaxURL += '&' + this.id + '_SubsiteID=' + this.subsiteID;
|
|
|
|
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
|
new Ajax.Request(ajaxURL, {
|
|
onSuccess : this.installSubtree.bind(this),
|
|
onFailure : function(response) { errorMessage('error loading subtree', response); }
|
|
});
|
|
}
|
|
}
|
|
SubsitesTreeDropdownField.applyTo('div.SubsitesTreeDropdownField'); |