Index: branches/RC/core/kernel/event_manager.php =================================================================== diff -u -N -r11665 -r11682 --- branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 11665) +++ branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 11682) @@ -399,8 +399,12 @@ // should do redirect but to no_permissions template $event->redirect = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); $event->redirect_params['pass'] = 'm'; - $event->redirect_params['m_cat_id'] = 0; + $themes_helper =& $this->Application->recallObject('ThemesHelper'); + /* @var $themes_helper kThemesHelper */ + + $event->redirect_params['m_cat_id'] = $themes_helper->getPageByTemplate($event->redirect); + // restore stuff, that processOpener() changed $wid = $this->Application->GetVar('m_wid'); $this->Application->RestoreVar(rtrim('opener_stack_'.$wid, '_')); @@ -508,7 +512,7 @@ } /** - * Used from relationship event handler + * Allows to add new element to opener stack * * @param string $template * @param Array $params @@ -538,6 +542,35 @@ $this->Application->StoreVar($stack_name, serialize($opener_stack)); } + /** + * Allows to change last element in opener stack + * + * @param string $template + * @param Array $params + * @param string $pass + */ + function openerStackChange($params = Array(), $pass_events = true, $wid = null) + { + if (!isset($wid)) { + $wid = $this->Application->GetVar('m_wid'); + } + + // get opener stack + $stack_name = rtrim('opener_stack_' . $wid, '_'); + $opener_stack = $this->Application->RecallVar($stack_name); + $opener_stack = $opener_stack ? unserialize($opener_stack) : Array (); + + // change opener stack + list ($index_file, $env) = explode('|', $opener_stack[ count($opener_stack) - 1 ], 2); + $vars = $this->Application->HttpQuery->processQueryString($env, 'pass'); + $vars = array_merge_recursive2($vars, $params); + + // save opener stack + $new_level = $this->Application->BuildEnv($vars['t'], $vars, $vars['pass'], $pass_events, false); + $opener_stack[ count($opener_stack) - 1 ] = $index_file . '|' . $new_level; + $this->Application->StoreVar($stack_name, serialize($opener_stack)); + } + function registerHook($hookto_prefix, $hookto_special, $hookto_event, $mode, $do_prefix, $do_special, $do_event, $conditional) { if ( !$this->Application->prefixRegistred($hookto_prefix) && $hookto_prefix != '*' ) {