var rcube_webmail_client; function rcube_webmail() { this.env = new Object(); this.buttons = new Object(); this.gui_objects = new Object(); this.commands = new Object(); this.selection = new Array(); // create public reference to myself rcube_webmail_client = this; this.ref = 'rcube_webmail_client'; // webmail client settings this.dblclick_time = 600; this.message_time = 10000; this.request_timeout = 120000; this.mbox_expression = new RegExp('[^0-9a-z\-_]', 'gi'); this.env.blank_img = 'skins/default/images/blank.gif'; // mimetypes supported by the browser (default settings) this.mimetypes = new Array('text/plain', 'text/html', 'text/xml', 'image/jpeg', 'image/gif', 'image/png', 'application/x-javascript', 'application/pdf', 'application/x-shockwave-flash'); // set environment variable this.set_env = function(name, value) { //if (!this.busy) this.env[name] = value; }; // register a specific gui object this.gui_object = function(name, id) { this.gui_objects[name] = id; }; // initialize webmail client this.init = function() { this.task = this.env.task; // check browser if (!bw.dom || !bw.xmlhttp_test()) { location.href = this.env.comm_path+'&_action=error&_code=0x199'; return; } // find all registered gui objects for (var n in this.gui_objects) this.gui_objects[n] = rcube_find_object(this.gui_objects[n]); // tell parent window that this frame is loaded if (this.env.framed && parent.rcmail && parent.rcmail.set_busy) parent.rcmail.set_busy(false); // enable general commands this.enable_command('logout', 'mail', 'addressbook', 'settings', true); // enable basic commands this.enable_command('logout', true); // disable browser's contextmenus //document.oncontextmenu = function(){ return false; } // flag object as complete this.loaded = true; // show message if (this.pending_message) this.display_message(this.pending_message[0], this.pending_message[1]); }; /*********************************************************/ /********* client command interface *********/ /*********************************************************/ // set command enabled or disabled this.enable_command = function() { var args = this.enable_command.arguments; if(!args.length) return -1; var command; var enable = args[args.length-1]; for(var n=0; n this.env.current_page)); this.enable_command('previouspage', (this.env.current_page > 1)); } // set button to a specific state this.set_button = function(command, state) { var a_buttons = this.buttons[command]; var button, obj; if(!a_buttons || !a_buttons.length) return; for(var n=0; n'+cont+''; this.gui_objects.message._rcube = this; this.gui_objects.message.innerHTML = cont; this.gui_objects.message.style.display = 'block'; if (type!='loading') this.gui_objects.message.onmousedown = function(){ this._rcube.hide_message(); return true; }; if (!hold) this.message_timer = setTimeout(this.ref+'.hide_message()', this.message_time); }; // make a message row disappear this.hide_message = function() { if (this.gui_objects.message) { this.gui_objects.message.style.display = 'none'; this.gui_objects.message.onmousedown = null; } }; // set all fields of a form disabled this.lock_form = function(form, lock) { if (!form || !form.elements) return; var type; for (var n=0; n