mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX: Fixed SubsitesVirtualPage operation for the main site, and fixed selection of currently selected value.
This commit is contained in:
parent
65dfa20031
commit
5406ab5b60
@ -248,7 +248,7 @@ JS;
|
|||||||
static function currentSubsiteID($cache = true) {
|
static function currentSubsiteID($cache = true) {
|
||||||
if(isset($_REQUEST['SubsiteID'])) {
|
if(isset($_REQUEST['SubsiteID'])) {
|
||||||
$id = (int)$_REQUEST['SubsiteID'];
|
$id = (int)$_REQUEST['SubsiteID'];
|
||||||
} else if(Session::get('SubsiteID')) {
|
} else {
|
||||||
$id = Session::get('SubsiteID');
|
$id = Session::get('SubsiteID');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,9 +34,7 @@ class SubsitesVirtualPage extends VirtualPage {
|
|||||||
|
|
||||||
if(Controller::curr()->getRequest()) {
|
if(Controller::curr()->getRequest()) {
|
||||||
$subsiteID = Controller::curr()->getRequest()->getVar('TreeDropdownField_Form_EditForm_CopyContentFromID_SubsiteID');
|
$subsiteID = Controller::curr()->getRequest()->getVar('TreeDropdownField_Form_EditForm_CopyContentFromID_SubsiteID');
|
||||||
if($subsiteID) {
|
$pageSelectionField->setSubsiteID($subsiteID);
|
||||||
$pageSelectionField->setSubsiteID($subsiteID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$fields->replaceField('CopyContentFromID', $pageSelectionField);
|
$fields->replaceField('CopyContentFromID', $pageSelectionField);
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@ SubsitesTreeDropdownField.prototype = {
|
|||||||
|
|
||||||
ajaxGetTree: function(after) {
|
ajaxGetTree: function(after) {
|
||||||
// This if block is necessary to maintain both 2.2 and 2.3 support
|
// This if block is necessary to maintain both 2.2 and 2.3 support
|
||||||
var baseURL = this.options.dropdownField.helperURLBase();
|
var baseURL = this.helperURLBase();
|
||||||
if(baseURL.match('action_callfieldmethod') var ajaxURL = baseURL+ '&methodName=gettree&forceValues=' + this.getIdx();
|
if(baseURL.match('action_callfieldmethod')) var ajaxURL = baseURL+ '&methodName=gettree&forceValues=' + this.inputTag.value;
|
||||||
else var ajaxURL = baseURL+ 'gettree?forceValues=' + this.getIdx();
|
else var ajaxURL = baseURL+ 'gettree?forceValues=' + this.inputTag.value;
|
||||||
|
|
||||||
// Customized: Append subsiteid (evaluated in SubsitesVirtualPage.php)
|
// Customized: Append subsiteid (evaluated in SubsitesVirtualPage.php)
|
||||||
if(this.subsiteID) ajaxURL += '&' + this.id + '_SubsiteID=' + this.subsiteID;
|
ajaxURL += '&' + this.id + '_SubsiteID=' + parseInt(this.subsiteID);
|
||||||
|
|
||||||
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
||||||
new Ajax.Request(ajaxURL, {
|
new Ajax.Request(ajaxURL, {
|
||||||
@ -20,6 +20,7 @@ SubsitesTreeDropdownField.prototype = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// This ajaxExpansion function is actually attached as a method on the tree object; therefore, this.getIdx() is a method
|
||||||
ajaxExpansion: function() {
|
ajaxExpansion: function() {
|
||||||
this.addNodeClass('loading');
|
this.addNodeClass('loading');
|
||||||
var ul = this.treeNodeHolder();
|
var ul = this.treeNodeHolder();
|
||||||
@ -27,11 +28,12 @@ SubsitesTreeDropdownField.prototype = {
|
|||||||
|
|
||||||
// This if block is necessary to maintain both 2.2 and 2.3 support
|
// This if block is necessary to maintain both 2.2 and 2.3 support
|
||||||
var baseURL = this.options.dropdownField.helperURLBase();
|
var baseURL = this.options.dropdownField.helperURLBase();
|
||||||
if(baseURL.match('action_callfieldmethod') var ajaxURL = baseURL+ '&methodName=gettree&SubtreeRootID=' + this.getIdx();
|
|
||||||
else var ajaxURL = baseURL+ 'gettree?SubtreeRootID=' + this.getIdx();
|
if(baseURL.match('action_callfieldmethod')) var ajaxURL = baseURL+ '&methodName=getsubtree&SubtreeRootID=' + this.getIdx();
|
||||||
|
else var ajaxURL = baseURL+ 'getsubtree?SubtreeRootID=' + this.getIdx();
|
||||||
|
|
||||||
// Customized: Append subsiteid (evaluated in SubsitesVirtualPage.php)
|
// Customized: Append subsiteid (evaluated in SubsitesVirtualPage.php)
|
||||||
if(this.subsiteID) ajaxURL += '&' + this.id + '_SubsiteID=' + this.subsiteID;
|
ajaxURL += '&' + this.id + '_SubsiteID=' + parseInt(this.subsiteID);
|
||||||
|
|
||||||
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
||||||
new Ajax.Request(ajaxURL, {
|
new Ajax.Request(ajaxURL, {
|
||||||
|
Loading…
Reference in New Issue
Block a user