Aleksander Machniak
2012-05-22 041c93ce0bc00cb6417ce2e4bdce2ed84d37f50a
program/js/app.js
@@ -17,8 +17,6 @@
 +-----------------------------------------------------------------------+
 | Requires: jquery.js, common.js, list.js                               |
 +-----------------------------------------------------------------------+
  $Id$
*/
function rcube_webmail()
@@ -54,9 +52,10 @@
  // set jQuery ajax options
  $.ajaxSetup({
    cache:false,
    error:function(request, status, err){ ref.http_error(request, status, err); },
    beforeSend:function(xmlhttp){ xmlhttp.setRequestHeader('X-Roundcube-Request', ref.env.request_token); }
    cache: false,
    timeout: this.env.request_timeout * 1000,
    error: function(request, status, err){ ref.http_error(request, status, err); },
    beforeSend: function(xmlhttp){ xmlhttp.setRequestHeader('X-Roundcube-Request', ref.env.request_token); }
  });
  // set environment variable(s)
@@ -766,7 +765,7 @@
      case 'always-load':
        if (this.env.uid && this.env.sender) {
          this.add_contact(urlencode(this.env.sender));
          this.add_contact(this.env.sender);
          setTimeout(function(){ ref.command('load-images'); }, 300);
          break;
        }
@@ -955,8 +954,6 @@
        form.action = this.add_url(form.action, '_lang', lang);
        form.submit();
        // clear timeout (sending could take longer)
        clearTimeout(this.request_timer);
        break;
      case 'send-attachment':
@@ -1158,14 +1155,6 @@
    if (this.gui_objects.editform)
      this.lock_form(this.gui_objects.editform, a);
    // clear pending timer
    if (this.request_timer)
      clearTimeout(this.request_timer);
    // set timer for requests
    if (a && this.env.request_timeout)
      this.request_timer = setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000);
    return id;
  };
@@ -1202,13 +1191,6 @@
      url = this.env.comm_path;
    return url.replace(/_task=[a-z]+/, '_task='+task);
  };
  // called when a request timed out
  this.request_timed_out = function()
  {
    this.set_busy(false);
    this.display_message('Request timed out!', 'error');
  };
  this.reload = function(delay)
@@ -3004,7 +2986,7 @@
      this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length);
      // add signature according to selected identity
      // if we have HTML editor, signature is added in callback
      if (input_from.prop('type') == 'select-one' && $("input[name='_draft_saveid']").val() == '') {
      if (input_from.prop('type') == 'select-one') {
        this.change_identity(input_from[0]);
      }
    }
@@ -3828,7 +3810,7 @@
    for (i=0; i<threads; i++) {
      source = this.ksearch_data.sources.shift();
      if (threads > 1 && source === null)
      if (threads > 1 && source === undefined)
        break;
      post_data._source = source ? source : '';
@@ -5997,7 +5979,7 @@
    return $.ajax({
      type: 'GET', url: url, data: { _unlock:(lock?lock:0) }, dataType: 'json',
      success: function(data){ ref.http_response(data); },
      error: function(o, status, err) { rcmail.http_error(o, status, err, lock); }
      error: function(o, status, err) { ref.http_error(o, status, err, lock, action); }
    });
  };
@@ -6029,7 +6011,7 @@
    return $.ajax({
      type: 'POST', url: url, data: postdata, dataType: 'json',
      success: function(data){ ref.http_response(data); },
      error: function(o, status, err) { rcmail.http_error(o, status, err, lock); }
      error: function(o, status, err) { ref.http_error(o, status, err, lock, action); }
    });
  };
@@ -6161,7 +6143,7 @@
  };
  // handle HTTP request errors
  this.http_error = function(request, status, err, lock)
  this.http_error = function(request, status, err, lock, action)
  {
    var errmsg = request.statusText;
@@ -6170,6 +6152,16 @@
    if (request.status && errmsg)
      this.display_message(this.get_label('servererror') + ' (' + errmsg + ')', 'error');
    else if (status == 'timeout')
      this.display_message(this.get_label('requesttimedout'), 'error');
    else if (request.status == 0 && status != 'abort')
      this.display_message(this.get_label('servererror') + ' (No connection)', 'error');
    // re-send keep-alive requests after 30 seconds
    if (action == 'keep-alive')
      setTimeout(function(){ ref.keep_alive(); }, 30000);
    else if (action == 'check-recent')
      setTimeout(function(){ ref.check_for_recent(false); }, 30000);
  };
  // post the given form to a hidden iframe