Changeset 294 in subversion


Ignore:
Timestamp:
Aug 6, 2006 9:24:11 AM (7 years ago)
Author:
thomasb
Message:

Added patch for Bug #1483932; Fixed attachment bug; Cleaned up JS vars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/app.js

    r292 r294  
    1919var SHIFT_KEY = 2; 
    2020var CONTROL_SHIFT_KEY = 3; 
    21 var DRAFT_AUTOSAVE = 5; // Minutes 
    2221 
    2322var rcube_webmail_client; 
     
    4140  this.dblclick_time = 600; 
    4241  this.message_time = 5000; 
    43   this.request_timeout = 180000; 
    44   this._interval = 60000; 
     42   
    4543  this.mbox_expression = new RegExp('[^0-9a-z\-_]', 'gi'); 
    46   this.env.blank_img = 'skins/default/images/blank.gif'; 
    4744   
    4845  // mimetypes supported by the browser (default settings) 
     
    5249                             'application/x-shockwave-flash'); 
    5350 
     51  // default environment vars 
     52  this.env.keep_alive = 60;        // seconds 
     53  this.env.request_timeout = 180;  // seconds 
     54  this.env.draft_autosave = 300;   // seconds 
     55 
    5456 
    5557  // set environment variable 
    5658  this.set_env = function(name, value) 
    5759    { 
    58     //if (!this.busy) 
    59       this.env[name] = value;     
     60    this.env[name] = value; 
    6061    }; 
    6162 
     
    247248    document.onmousedown = function(){ return rcube_webmail_client.reset_click(); }; 
    248249    document.onkeydown   = function(e){ return rcube_webmail_client.key_pressed(e, msg_list_frame); }; 
    249  
    250     // set default keep alive interval 
    251     if (!this.keep_alive_interval) 
    252       this.keep_alive_interval = this._interval; 
    253250     
    254251    // flag object as complete 
    255252    this.loaded = true; 
    256            
     253 
    257254    // show message 
    258255    if (this.pending_message) 
    259256      this.display_message(this.pending_message[0], this.pending_message[1]); 
    260        
    261     // start interval for keep-alive/recent_check signal 
    262     if (this.keep_alive_interval && this.task=='mail' && this.gui_objects.messagelist) 
    263       this._int = setInterval(this.ref+'.check_for_recent()', this.keep_alive_interval); 
    264     else if (this.task!='login') 
    265       this._int = setInterval(this.ref+'.send_keep_alive()', this.keep_alive_interval); 
    266     }; 
     257 
     258    // start keep-alive interval 
     259    this.start_keepalive(); 
     260    }; 
     261 
     262 
     263  // start interval for keep-alive/recent_check signal 
     264  this.start_keepalive = function() 
     265    { 
     266    if (this.env.keep_alive && this.task=='mail' && this.gui_objects.messagelist) 
     267      this._int = setInterval(this.ref+'.check_for_recent()', this.env.keep_alive * 1000); 
     268    else if (this.env.keep_alive && this.task!='login') 
     269      this._int = setInterval(this.ref+'.send_keep_alive()', this.env.keep_alive * 1000);     
     270    } 
     271 
    267272 
    268273  // reset last clicked if user clicks on anything other than the message table 
     
    952957        if (!this.check_compose_input()) 
    953958          break; 
     959           
     960        // Reset the auto-save timer 
     961        self.clearTimeout(this.save_timer); 
    954962 
    955963        // all checks passed, send message 
     
    959967        form._draft.value = ''; 
    960968        form.submit(); 
     969         
     970        // clear timeout (sending could take longer) 
     971        clearTimeout(this.request_timer); 
    961972        break; 
    962973 
     
    11311142 
    11321143    // set timer for requests 
    1133     if (a && this.request_timeout) 
    1134       this.request_timer = setTimeout(this.ref+'.request_timed_out()', this.request_timeout); 
     1144    if (a && this.env.request_timeout) 
     1145      this.request_timer = setTimeout(this.ref+'.request_timed_out()', this.env.request_timeout * 1000); 
    11351146    }; 
    11361147 
     
    20162027  this.auto_save_start = function() 
    20172028    { 
    2018     this.save_timer = self.setTimeout('rcmail.command("savedraft","",this)', DRAFT_AUTOSAVE * 60000); 
     2029    if (this.env.draft_autosave) 
     2030      this.save_timer = self.setTimeout(this.ref+'.command("savedraft")', this.env.draft_autosave * 1000); 
    20192031    }; 
    20202032 
     
    21692181  // add file name to attachment list 
    21702182  // called from upload page 
    2171   this.add2attachment_list = function(name,content) 
     2183  this.add2attachment_list = function(name, content) 
    21722184    { 
    21732185    if (!this.gui_objects.attachmentlist) 
     
    21892201    for (i=0;i<list.length;i++) 
    21902202      if (list[i].id == name) 
    2191         this.gui_objects.attachmentlist.removeChild(list[i]); 
     2203        this.gui_objects.attachmentlist.removeChild(list[i]); 
    21922204    }; 
    21932205 
     
    21952207    { 
    21962208    if (name) 
    2197       this.http_request('remove-attachment', '_filename='+escape(name)); 
     2209      this.http_request('remove-attachment', '_file='+escape(name)); 
    21982210 
    21992211    return true; 
     
    35663578  this.http_error = function(request_obj) 
    35673579    { 
    3568     alert('Error sending request: '+request_obj.url); 
     3580    //alert('Error sending request: '+request_obj.url); 
    35693581 
    35703582    if (request_obj.__lock) 
     
    38293841    else if(this.xmlhttp.readyState == 4) 
    38303842      { 
    3831       if(this.xmlhttp.status == 0) 
    3832         this.onabort(this); 
    3833       else if(this.xmlhttp.status == 200) 
    3834         this.oncomplete(this); 
    3835       else 
     3843      try { 
     3844        if (this.xmlhttp.status == 0) 
     3845          this.onabort(this); 
     3846        else if(this.xmlhttp.status == 200) 
     3847          this.oncomplete(this); 
     3848        else 
     3849          this.onerror(this); 
     3850 
     3851        this.busy = false; 
     3852        } 
     3853      catch(err) 
     3854        { 
    38363855        this.onerror(this); 
    3837          
    3838       this.busy = false; 
     3856        this.busy = false; 
     3857        } 
    38393858      } 
    38403859    } 
Note: See TracChangeset for help on using the changeset viewer.