Index: branches/5.1.x/core/units/phrases/phrases_event_handler.php =================================================================== diff -u -N -r14338 -r14390 --- branches/5.1.x/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 14338) +++ branches/5.1.x/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 14390) @@ -1,6 +1,6 @@ SetRedirectParam($event->getPrefixSpecial(true) . '_id', $phrase_id); $event->SetRedirectParam('pass', 'm,' . $event->getPrefixSpecial()); + + $next_template = $this->Application->GetVar('next_template'); + + if ($next_template) { + $event->SetRedirectParam('next_template', $next_template); + } } else { $event->CallSubEvent('OnNew'); @@ -172,18 +178,42 @@ $object->SwitchToLive(); } - $next_template = $this->Application->GetVar('next_template'); - - if ($next_template) { - $event->redirect = $next_template; - $event->SetRedirectParam('opener', 's'); - } + $this->returnToOriginalTemplate($event); } parent::OnCreate($event); } /** + * Redirects to original template after phrase is being update + * + * @param kEvent $event + */ + function OnUpdate(&$event) + { + if ( $this->Application->GetVar($event->Prefix . '_label') ) { + $this->returnToOriginalTemplate($event); + } + + parent::OnUpdate($event); + } + + /** + * Returns to original template after phrase adding/editing + * + * @param kEvent $event + */ + function returnToOriginalTemplate(&$event) + { + $next_template = $this->Application->GetVar('next_template'); + + if ($next_template) { + $event->redirect = $next_template; + $event->SetRedirectParam('opener', 's'); + } + } + + /** * Set last change info, when phrase is created * * @param kEvent $event