| | |
| | | if (over) button_prop.over = over; |
| | | |
| | | this.buttons[command].push(button_prop); |
| | | |
| | | if (this.loaded) |
| | | init_button(command, button_prop); |
| | | }; |
| | | |
| | | // register a specific gui object |
| | | this.gui_object = function(name, id) |
| | | { |
| | | this.gui_objects[name] = id; |
| | | this.gui_objects[name] = this.loaded ? rcube_find_object(id) : id; |
| | | }; |
| | | |
| | | // register a container object |
| | |
| | | /********* GUI functionality *********/ |
| | | /*********************************************************/ |
| | | |
| | | // enable/disable buttons for page shifting |
| | | this.set_page_buttons = function() |
| | | var init_button = function(cmd, prop) |
| | | { |
| | | this.enable_command('nextpage', 'lastpage', (this.env.pagecount > this.env.current_page)); |
| | | this.enable_command('previouspage', 'firstpage', (this.env.current_page > 1)); |
| | | }; |
| | | |
| | | // set event handlers on registered buttons |
| | | this.init_buttons = function() |
| | | { |
| | | for (var cmd in this.buttons) { |
| | | if (typeof cmd !== 'string') |
| | | continue; |
| | | |
| | | for (var i=0; i< this.buttons[cmd].length; i++) { |
| | | var prop = this.buttons[cmd][i]; |
| | | var elm = document.getElementById(prop.id); |
| | | if (!elm) |
| | | continue; |
| | | return; |
| | | |
| | | var preload = false; |
| | | if (prop.type == 'image') { |
| | |
| | | if (preload) |
| | | new Image().src = prop.over; |
| | | } |
| | | }; |
| | | |
| | | // enable/disable buttons for page shifting |
| | | this.set_page_buttons = function() |
| | | { |
| | | this.enable_command('nextpage', 'lastpage', (this.env.pagecount > this.env.current_page)); |
| | | this.enable_command('previouspage', 'firstpage', (this.env.current_page > 1)); |
| | | }; |
| | | |
| | | // set event handlers on registered buttons |
| | | this.init_buttons = function() |
| | | { |
| | | for (var cmd in this.buttons) { |
| | | if (typeof cmd !== 'string') |
| | | continue; |
| | | |
| | | for (var i=0; i< this.buttons[cmd].length; i++) { |
| | | init_button(cmd, this.buttons[cmd][i]); |
| | | } |
| | | } |
| | | }; |
| | |
| | | var base = this.env.comm_path; |
| | | |
| | | // overwrite task name |
| | | if (query._action.match(/([a-z]+)\/([a-z-_]+)/)) { |
| | | if (query._action.match(/([a-z]+)\/([a-z-_.]+)/)) { |
| | | query._action = RegExp.$2; |
| | | base = base.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); |
| | | } |