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:
Ingo Schommer 2011-09-05 17:54:40 +02:00
parent 7cf7a788d1
commit 069c5ada3c
2 changed files with 2 additions and 39 deletions

View File

@ -5,9 +5,6 @@
* @package subsites * @package subsites
*/ */
class LeftAndMainSubsites extends Extension { class LeftAndMainSubsites extends Extension {
static $allowed_actions = array(
'changesubsite',
);
function init() { function init() {
Requirements::css('subsites/css/LeftAndMain_Subsites.css'); Requirements::css('subsites/css/LeftAndMain_Subsites.css');
@ -27,24 +24,6 @@ class LeftAndMainSubsites extends Extension {
$fields->push(new HiddenField('SubsiteID', 'SubsiteID', Subsite::currentSubsiteID())); $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() { public function Subsites() {
$accessPerm = 'CMS_ACCESS_'. $this->owner->class; $accessPerm = 'CMS_ACCESS_'. $this->owner->class;

View File

@ -1,23 +1,7 @@
Behaviour.register({ Behaviour.register({
'#SubsiteActions select' : { '#SubsiteActions select' : {
onchange: function() { onchange: function() {
if($('Form_AddPageOptionsForm_SubsiteID')) { document.location.href = SiteTreeHandlers.controller_url + '?SubsiteID=' + this.value;
$('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);
}
});
} }
}, },