Index: trunk/core/kernel/session/session.php =================================================================== diff -u -N -r4626 -r4630 --- trunk/core/kernel/session/session.php (.../session.php) (revision 4626) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 4630) @@ -649,13 +649,13 @@ function SaveData() { - if( $this->Application->GetVar('t') != 'help' && !$this->Application->GetVar('skip_last_template')) - { - $last_env = $this->Application->BuildEnv($this->Application->GetVar('t'), Array('m_opener' => 'u', '__URLENCODE__' => 1), 'all'); + if (!$this->Application->GetVar('skip_last_template')) { + $t = $this->Application->GetVar('t'); + $last_env = $this->Application->BuildEnv($t, Array('m_opener' => 'u', '__URLENCODE__' => 1), 'all'); $last_template = basename($_SERVER['PHP_SELF']).'|'; $last_template .= substr($last_env, strlen(ENV_VAR_NAME) + 1); $this->StoreVar('last_template', $last_template); - $this->StoreVar('last_env', substr($this->Application->BuildEnv($this->Application->GetVar('t'),Array('pass'=>'all', '__URLENCODE__' => 1)), strlen(ENV_VAR_NAME)+1 )); + $this->StoreVar('last_env', substr($this->Application->BuildEnv($t, Array('pass'=>'all', '__URLENCODE__' => 1)), strlen(ENV_VAR_NAME)+1)); } $this->PrintSession('after save'); Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r4627 -r4630 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4627) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4630) @@ -57,12 +57,7 @@ */ function CheckPermission(&$event) { - if ($event->Name == 'OnSave') { - // check is made in OnPreSave subevent - return true; - } - - if (substr($event->Name, 0, 9) == 'OnPreSave') { + if ((substr($event->Name, 0, 9) == 'OnPreSave') || ($event->Name == 'OnSave')) { $section = $event->getSection(); if ($this->isNewItemCreate($event)) { return $this->Application->CheckPermission($section.'.add'); @@ -103,6 +98,13 @@ 'OnCancel' => Array('self' => 'add|edit', 'subitem' => 'add|edit'), 'OnSetSorting' => Array('self' => 'view', 'subitem' => 'view'), + 'OnSetSortingDirect' => Array('self' => 'view', 'subitem' => 'view'), + + 'OnSetFilter' => Array('self' => 'view', 'subitem' => 'view'), + 'OnApplyFilters' => Array('self' => 'view', 'subitem' => 'view'), + 'OnRemoveFilters' => Array('self' => 'view', 'subitem' => 'view'), + + 'OnSetPerPage' => Array('self' => 'view', 'subitem' => 'view'), ); $this->permMapping = array_merge($this->permMapping, $permissions); } Index: trunk/core/kernel/event_manager.php =================================================================== diff -u -N -r4627 -r4630 --- trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 4627) +++ trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 4630) @@ -217,8 +217,6 @@ function ProcessRequest() { - $skip_last_template = $this->Application->GetVar('skip_last_template'); - $this->processOpener(); // 1. get events from $_POST @@ -275,7 +273,8 @@ $event->redirect = $event->getEventParam('no_permissions_template') ? $event->getEventParam('no_permissions_template') : 'no_permissions'; // restore stuff, that processOpener() changed $this->Application->RestoreVar('opener_stack'); - $this->Application->SetVar('skip_last_template', $skip_last_template); + // 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); } // should do redirect but to no_permissions template Index: trunk/kernel/admin_templates/no_permission.tpl =================================================================== diff -u -N -r4627 -r4630 --- trunk/kernel/admin_templates/no_permission.tpl (.../no_permission.tpl) (revision 4627) +++ trunk/kernel/admin_templates/no_permission.tpl (.../no_permission.tpl) (revision 4630) @@ -3,9 +3,7 @@ - - - + @@ -19,11 +17,12 @@ a_toolbar.AddButton( new ToolBarButton('prev', '', function() { - + if (window.opener != null) { window.close(); - + } + else { history.back(); - + } } ) ); a_toolbar.Render(); Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r4603 -r4630 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4603) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4630) @@ -30,7 +30,7 @@