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,10 +5,7 @@
* @package subsites
*/
class LeftAndMainSubsites extends Extension {
static $allowed_actions = array(
'changesubsite',
);
function init() {
Requirements::css('subsites/css/LeftAndMain_Subsites.css');
Requirements::javascript('subsites/javascript/LeftAndMain_Subsites.js');
@ -26,24 +23,6 @@ class LeftAndMainSubsites extends Extension {
function updatePageOptions(&$fields) {
$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;

View File

@ -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;
}
},