Index: trunk/kernel/admin_templates/popups/translator.tpl =================================================================== diff -u -N -r4674 -r4785 --- trunk/kernel/admin_templates/popups/translator.tpl (.../translator.tpl) (revision 4674) +++ trunk/kernel/admin_templates/popups/translator.tpl (.../translator.tpl) (revision 4785) @@ -40,9 +40,11 @@ - -> - + + + > + + Reload frame || Show debugger @@ -69,14 +71,7 @@ } ) ); - a_toolbar.AddButton( new ToolBarSeparator('sep2') ); - a_toolbar.Render(); - - function edit() - { - // required for correct row selection - } Index: trunk/kernel/units/translator/translator_event_handler.php =================================================================== diff -u -N -r4287 -r4785 --- trunk/kernel/units/translator/translator_event_handler.php (.../translator_event_handler.php) (revision 4287) +++ trunk/kernel/units/translator/translator_event_handler.php (.../translator_event_handler.php) (revision 4785) @@ -2,17 +2,56 @@ class TranslatorEventHandler extends InpDBEventHandler { + /** + * Allows to override standart permission mapping + * + */ + function mapPermissions() + { + parent::mapPermissions(); + $permissions = Array( + 'OnChangeLanguage' => Array('subitem' => 'add|edit'), + 'OnSaveAndClose' => Array('subitem' => 'add|edit'), + ); + $this->permMapping = array_merge($this->permMapping, $permissions); + } - function OnLoad(&$event) + /** + * Check permission of item, that being translated + * + * @param kEvent $event + */ + function CheckPermission(&$event) { + list($prefix, $field) = $this->getPrefixAndField($event); + + $top_prefix = $this->Application->GetTopmostPrefix($prefix); + $event->setEventParam('top_prefix', $top_prefix); + return parent::CheckPermission($event); + } + + + /** + * Returns prefix and field being translated + * + * @param kEvent $event + */ + function getPrefixAndField(&$event) + { $field = $this->Application->GetVar($event->getPrefixSpecial(true).'_field'); if (strpos($field,':') !== false) { - list($obj_prefix,$field) = explode(':', $field); + list($prefix, $field) = explode(':', $field); } else { - $obj_prefix = $this->Application->GetVar($event->getPrefixSpecial(true).'_prefix'); + $prefix = $this->Application->GetVar($event->getPrefixSpecial(true).'_prefix'); } + return Array($prefix, $field); + } + + function OnLoad(&$event) + { + list($obj_prefix, $field) = $this->getPrefixAndField($event); $object =& $this->Application->recallObject($obj_prefix); $translator =& $this->Application->recallObject($event->getPrefixSpecial()); Index: trunk/core/units/translator/translator_event_handler.php =================================================================== diff -u -N -r4287 -r4785 --- trunk/core/units/translator/translator_event_handler.php (.../translator_event_handler.php) (revision 4287) +++ trunk/core/units/translator/translator_event_handler.php (.../translator_event_handler.php) (revision 4785) @@ -2,17 +2,56 @@ class TranslatorEventHandler extends InpDBEventHandler { + /** + * Allows to override standart permission mapping + * + */ + function mapPermissions() + { + parent::mapPermissions(); + $permissions = Array( + 'OnChangeLanguage' => Array('subitem' => 'add|edit'), + 'OnSaveAndClose' => Array('subitem' => 'add|edit'), + ); + $this->permMapping = array_merge($this->permMapping, $permissions); + } - function OnLoad(&$event) + /** + * Check permission of item, that being translated + * + * @param kEvent $event + */ + function CheckPermission(&$event) { + list($prefix, $field) = $this->getPrefixAndField($event); + + $top_prefix = $this->Application->GetTopmostPrefix($prefix); + $event->setEventParam('top_prefix', $top_prefix); + return parent::CheckPermission($event); + } + + + /** + * Returns prefix and field being translated + * + * @param kEvent $event + */ + function getPrefixAndField(&$event) + { $field = $this->Application->GetVar($event->getPrefixSpecial(true).'_field'); if (strpos($field,':') !== false) { - list($obj_prefix,$field) = explode(':', $field); + list($prefix, $field) = explode(':', $field); } else { - $obj_prefix = $this->Application->GetVar($event->getPrefixSpecial(true).'_prefix'); + $prefix = $this->Application->GetVar($event->getPrefixSpecial(true).'_prefix'); } + return Array($prefix, $field); + } + + function OnLoad(&$event) + { + list($obj_prefix, $field) = $this->getPrefixAndField($event); $object =& $this->Application->recallObject($obj_prefix); $translator =& $this->Application->recallObject($event->getPrefixSpecial()); Index: trunk/kernel/admin_templates/incs/header.tpl =================================================================== diff -u -N -r4653 -r4785 --- trunk/kernel/admin_templates/incs/header.tpl (.../header.tpl) (revision 4653) +++ trunk/kernel/admin_templates/incs/header.tpl (.../header.tpl) (revision 4785) @@ -39,9 +39,9 @@ - + > - + Index: trunk/core/units/translator/translator_config.php =================================================================== diff -u -N -r3299 -r4785 --- trunk/core/units/translator/translator_config.php (.../translator_config.php) (revision 3299) +++ trunk/core/units/translator/translator_config.php (.../translator_config.php) (revision 4785) @@ -11,7 +11,7 @@ 'QueryString' => Array( 1 => 'prefix', 2 => 'field', - 3 => 'multi_line', + 3 => 'multi_line', 4 => 'event', ), 'IDField' => 'N/A', @@ -43,8 +43,7 @@ 'VirtualFields' => Array( 'Original' => Array(), 'Language' => Array(), - 'SwitchLanguage' => Array('formatter'=>'kOptionsFormatter', - 'options_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field'=>'LanguageId','option_title_field'=>'PackName'), + 'SwitchLanguage' => Array('formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field' => 'LanguageId','option_title_field' => 'PackName'), 'Translation' => Array(), ), 'Grids' => Array(), Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r4762 -r4785 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4762) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4785) @@ -95,6 +95,8 @@ { parent::mapPermissions(); $permissions = Array( + 'OnLoad' => Array('self' => 'view', 'subitem' => 'view'), + 'OnNew' => Array('self' => 'add', 'subitem' => 'add|edit'), 'OnCreate' => Array('self' => 'add', 'subitem' => 'add|edit'), 'OnUpdate' => Array('self' => 'edit', 'subitem' => 'add|edit'), Index: trunk/kernel/units/translator/translator_config.php =================================================================== diff -u -N -r3299 -r4785 --- trunk/kernel/units/translator/translator_config.php (.../translator_config.php) (revision 3299) +++ trunk/kernel/units/translator/translator_config.php (.../translator_config.php) (revision 4785) @@ -11,7 +11,7 @@ 'QueryString' => Array( 1 => 'prefix', 2 => 'field', - 3 => 'multi_line', + 3 => 'multi_line', 4 => 'event', ), 'IDField' => 'N/A', @@ -43,8 +43,7 @@ 'VirtualFields' => Array( 'Original' => Array(), 'Language' => Array(), - 'SwitchLanguage' => Array('formatter'=>'kOptionsFormatter', - 'options_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field'=>'LanguageId','option_title_field'=>'PackName'), + 'SwitchLanguage' => Array('formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field' => 'LanguageId','option_title_field' => 'PackName'), 'Translation' => Array(), ), 'Grids' => Array(), Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r4783 -r4785 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4783) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4785) @@ -430,7 +430,7 @@ function loadConfig($prefix) { if (!isset($this->prefixFiles[$prefix])) { - trigger_error('Configuration file for prefix '.$prefix.' is unknown', E_USER_ERROR); + trigger_error('Configuration file for prefix '.$prefix.' is unknown', E_USER_ERROR); return ; } $file = $this->prefixFiles[$prefix]; Index: trunk/core/kernel/utility/event.php =================================================================== diff -u -N -r4689 -r4785 --- trunk/core/kernel/utility/event.php (.../event.php) (revision 4689) +++ trunk/core/kernel/utility/event.php (.../event.php) (revision 4785) @@ -282,7 +282,7 @@ */ function getSection() { - $perm_section = $this->getEventParam('PermSection'); + $perm_section = $this->getEventParam('PermSection'); if ($perm_section) { return $perm_section; } Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r4749 -r4785 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4749) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4785) @@ -22,7 +22,7 @@ - +