The reason why the shortcut keys were broken: keys and commands are implemented with...
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Dec 2005 02:21:53 +0000 (02:21 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Dec 2005 02:21:53 +0000 (02:21 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2494 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/util/controller.js

index f944451..e6b9a9d 100644 (file)
@@ -10,11 +10,14 @@ util.controller = function () {
 
 util.controller.prototype = {
 
+       'cmds' : {},
+
        'init' : function (params) {
 
                if (typeof params.control_map == 'undefined') throw('util.controller.init: No control_map');
 
                this.control_map = params.control_map;
+               this.window_knows_me_by = params.window_knows_me_by;
                this.render_list = [];
                this.view = {};
                
@@ -28,6 +31,11 @@ util.controller.prototype = {
                                                        case 'render':
                                                                this.render_list.push( [i, this.control_map[i][1](cmd)] ); 
                                                        break;
+                                                       case 'on_command':
+                                                               if (!this.window_knows_me_by) 
+                                                                       throw('util.controller: on_command requires window_knows_me_by');
+                                                               cmd.setAttribute(ev_type, this.window_knows_me_by . ".cmds." i . "()"); 
+                                                       break;
                                                        default: cmd.addEventListener(ev_type,this.control_map[i][1],false);
                                                }
                                        }