Index: branches/RC/core/admin_templates/js/application.js =================================================================== diff -u -N -r11546 -r11928 --- branches/RC/core/admin_templates/js/application.js (.../application.js) (revision 11546) +++ branches/RC/core/admin_templates/js/application.js (.../application.js) (revision 11928) @@ -94,7 +94,22 @@ } } -kApplication.prototype.processHooks = function ($hook_to, $hook_mode) { +kApplication.prototype.processHooks = function ($hook_to, $hook_mode, $event_params) { + // allows to hook to any event from given prefix using "prefix:*" like $function_name + if (!isset($event_params)) { + $event_params = {}; + } + + if (($hook_to.indexOf('*') == -1) && ($hook_to.indexOf(':') != -1)) { + var $do_event = new kEvent($hook_to, $event_params); + $event_params.OriginalName = $do_event.Name; + + if (!this.processHooks($do_event.Prefix + ':*', $hook_mode, $event_params)) { + return false; + } + } + + // allows to hook to specific given event from given prefix if (!isset($hook_mode)) { $hook_mode = hBEFORE; } @@ -103,7 +118,7 @@ var $defined_hooks = getArrayValue(this.Hooks, $hook_to, $hook_mode); while($i < $defined_hooks.length) { - var $do_event = new kEvent($hook_to); + var $do_event = new kEvent($hook_to, $event_params); $defined_hooks[$i]($do_event); if (!$do_event.status) { return false; @@ -116,17 +131,13 @@ // ======================================= -function kEvent($params) { - if ($params.match(/([^.:]*)[.]{0,1}([^:]*):(.*)/, $params)) { +function kEvent($name, $params) { + if ($name.match(/([^.:]*)[.]{0,1}([^:]*):(.*)/)) { this.Prefix = RegExp.$1; this.Special = RegExp.$2; this.Name = RegExp.$3; + this.Params = $params; } - else { - this.Prefix = ''; - this.Special = ''; - this.Name = ''; - } this.status = true; } \ No newline at end of file