Index: branches/unlabeled/unlabeled-1.39.8/core/kernel/event_manager.php =================================================================== diff -u -r6842 -r6862 --- branches/unlabeled/unlabeled-1.39.8/core/kernel/event_manager.php (.../event_manager.php) (revision 6842) +++ branches/unlabeled/unlabeled-1.39.8/core/kernel/event_manager.php (.../event_manager.php) (revision 6862) @@ -282,7 +282,8 @@ $event->redirect_params['m_cat_id'] = 0; // restore stuff, that processOpener() changed - $this->Application->RestoreVar('opener_stack'); + $wid = $this->Application->GetVar('m_wid'); + $this->Application->RestoreVar(rtrim('opener_stack_'.$wid, '_')); // don't save last_template, because no_permission template does js history.back and could cause invalid opener_stack content $this->Application->SetVar('skip_last_template', 1); } @@ -294,6 +295,13 @@ if ($event->redirect === true && !isset($event->redirect_params['pass_category']) && $this->Application->GetVar('m_cat_id')) { $event->redirect_params['pass_category'] = 1; } + + $wid = $this->Application->GetVar('m_wid'); + if ($wid && $event->redirect_params['opener'] == 'u') { + $event->redirect_params['opener'] = 's'; // because Application->HREF will react differently when 'opener' = 'u' + $event->redirect = 'incs/close_popup'; + } + $this->Application->Redirect($event->redirect, $event->redirect_params, null, $event->redirect_script); } } @@ -304,9 +312,12 @@ function processOpener() { - $opener_action = $this->Application->GetVar('m_opener'); - $opener_stack = $this->Application->RecallVar('opener_stack'); + $wid = $this->Application->GetVar('m_wid'); + + $opener_stack = $this->Application->RecallVar(rtrim('opener_stack_'.$wid, '_')); $opener_stack = $opener_stack ? unserialize($opener_stack) : Array(); + + $opener_action = $this->Application->GetVar('m_opener'); switch ($opener_action) { case 'r': // "reset" opener stack $opener_stack = Array(); @@ -327,17 +338,23 @@ break; case 'p': //pop-up - do not store last template - $this->Application->SetVar('skip_last_template', 1); + $parent_wid = $this->Application->GetVar('m_wid'); // window_id of popup's parent window + $popup_wid = (int)$this->Application->RecallVar('last_wid') + 1; + $this->Application->StoreVar('last_wid', $popup_wid); + $this->Application->SetVar('m_wid', $popup_wid); + $opener_stack = Array ( $this->Application->RecallVar(rtrim('last_template_popup_'.$parent_wid, '_')) ); + $this->Application->SetVar('m_opener', 's'); + $wid = $popup_wid; +// $this->Application->SetVar('skip_last_template', 1); break; default: // "s/0," stay on same deep level break; } - if (!$this->Application->GetVar('skip_last_template')) { - $this->Application->SetVar('m_opener', 's'); - } - $this->Application->StoreVar('opener_stack', serialize($opener_stack)); + + $this->Application->SetVar('m_opener', 's'); + $this->Application->StoreVar(rtrim('opener_stack_'.$wid, '_'), serialize($opener_stack)); }