mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX Removed ajaxified switch of subsite in the CMS, as it would need to deal with too much UI state like refreshing the "insert link" panel. Refresh the entire window instead.
This commit is contained in:
parent
7cf7a788d1
commit
069c5ada3c
@ -5,9 +5,6 @@
|
||||
* @package subsites
|
||||
*/
|
||||
class LeftAndMainSubsites extends Extension {
|
||||
static $allowed_actions = array(
|
||||
'changesubsite',
|
||||
);
|
||||
|
||||
function init() {
|
||||
Requirements::css('subsites/css/LeftAndMain_Subsites.css');
|
||||
@ -27,24 +24,6 @@ class LeftAndMainSubsites extends Extension {
|
||||
$fields->push(new HiddenField('SubsiteID', 'SubsiteID', Subsite::currentSubsiteID()));
|
||||
}
|
||||
|
||||
|
||||
public function changesubsite() {
|
||||
$id = $_REQUEST['SubsiteID'];
|
||||
|
||||
Subsite::changeSubsite($id==-1 ? 0 : $id);
|
||||
|
||||
if ($id == '-1') Cookie::set('noSubsiteFilter', 'true', 1);
|
||||
else Cookie::set('noSubsiteFilter', 'false', 1);
|
||||
|
||||
if(Director::is_ajax()) {
|
||||
$tree = $this->owner->SiteTreeAsUL();
|
||||
$tree = ereg_replace('^[ \t\r\n]*<ul[^>]*>','', $tree);
|
||||
$tree = ereg_replace('</ul[^>]*>[ \t\r\n]*$','', $tree);
|
||||
return $tree;
|
||||
} else
|
||||
return array();
|
||||
}
|
||||
|
||||
public function Subsites() {
|
||||
$accessPerm = 'CMS_ACCESS_'. $this->owner->class;
|
||||
|
||||
|
@ -1,23 +1,7 @@
|
||||
Behaviour.register({
|
||||
'#SubsiteActions select' : {
|
||||
onchange: function() {
|
||||
if($('Form_AddPageOptionsForm_SubsiteID')) {
|
||||
$('Form_AddPageOptionsForm_SubsiteID').value = this.value;
|
||||
}
|
||||
var request = new Ajax.Request(SiteTreeHandlers.controller_url + '/changesubsite?SubsiteID=' + this.value + '&ajax=1', {
|
||||
onSuccess: function(response) {
|
||||
if ($('sitetree')) {
|
||||
$('sitetree').innerHTML = response.responseText;
|
||||
SiteTree.applyTo($('sitetree'));
|
||||
$('sitetree').getTreeNodeByIdx(0).onselect();
|
||||
$('siteTreeFilterList').reapplyIfNeeded();
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(response) {
|
||||
errorMessage('Could not change subsite', response);
|
||||
}
|
||||
});
|
||||
document.location.href = SiteTreeHandlers.controller_url + '?SubsiteID=' + this.value;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user