thomascube
2011-07-30 fcc7f861b170596c6970aecb1ddc87a3567b112f
program/js/app.js
@@ -252,7 +252,10 @@
        }
        // show printing dialog
        else if (this.env.action == 'print' && this.env.uid)
          window.print();
          if (bw.safari)
            window.setTimeout('window.print()', 10);
          else
            window.print();
        // get unread count for each mailbox
        if (this.gui_objects.mailboxlist) {
@@ -429,6 +432,11 @@
    this.start_keepalive();
  };
  this.log = function(msg)
  {
    if (window.console && console.log)
      console.log(msg);
  };
  /*********************************************************/
  /*********       client command interface        *********/
@@ -1872,9 +1880,7 @@
    if (action == 'preview' && String(target.location.href).indexOf(url) >= 0)
      this.show_contentframe(true);
    else {
      if (!this.env.frame_lock) {
        (this.is_framed() ? parent.rcmail : this).env.frame_lock = this.set_busy(true, 'loading');
      }
      this.lock_frame();
      this.location_href(this.env.comm_path+url, target);
      // mark as read and change mbox unread counter
@@ -1907,6 +1913,12 @@
    if (!show && this.busy)
      this.set_busy(false, null, this.env.frame_lock);
  };
  this.lock_frame = function()
  {
    if (!this.env.frame_lock)
      (this.is_framed() ? parent.rcmail : this).env.frame_lock = this.set_busy(true, 'loading');
  };
  // list a specific page
@@ -3898,8 +3910,10 @@
      if (this.env.group)
        add_url += '&_gid='+urlencode(this.env.group);
      this.set_busy(true);
      this.location_href(this.env.comm_path+'&_action='+action+'&_source='+urlencode(this.env.source)+'&_cid='+urlencode(cid) + add_url, target);
      this.lock_frame();
      this.location_href(this.env.comm_path+'&_action='+action
        +'&_source='+urlencode(this.env.source)
        +'&_cid='+urlencode(cid) + add_url, target);
    }
    return true;
  };
@@ -4419,6 +4433,7 @@
      this.contact_list.clear_selection();
    }
    this.lock_frame();
    this.location_href(this.env.comm_path+'&_action=search'+add_url, target);
    return true;
@@ -4452,6 +4467,7 @@
        add_url = '&_framed=1';
        target = window.frames[this.env.contentframe];
      }
      this.lock_frame();
      this.location_href(this.env.comm_path+'&_action=edit-prefs&_section='+id+add_url, target);
    }
@@ -4853,9 +4869,7 @@
      this.show_contentframe(true);
    }
    else {
      if (!this.env.frame_lock) {
        (parent.rcmail ? parent.rcmail : this).env.frame_lock = this.set_busy(true, 'loading');
      }
      this.lock_frame();
      this.location_href(this.env.comm_path+url, target);
    }
  };
@@ -5139,7 +5153,8 @@
      obj.click(function() { return ref.hide_message(obj); });
    }
    window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
    if (timeout > 0)
      window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
    return id;
  };
@@ -5497,11 +5512,11 @@
      url = '?_task=utils&_action=html2text',
      lock = this.set_busy(true, 'converting');
    console.log('HTTP POST: ' + url);
    this.log('HTTP POST: ' + url);
    $.ajax({ type: 'POST', url: url, data: htmlText, contentType: 'application/octet-stream',
      error: function(o, status, err) { rcmail.http_error(o, status, err, lock); },
      success: function(data) { rcmail.set_busy(false, null, lock); $(document.getElementById(id)).val(data); console.log(data); }
      success: function(data) { rcmail.set_busy(false, null, lock); $(document.getElementById(id)).val(data); rcmail.log(data); }
    });
  };
@@ -5594,7 +5609,7 @@
    url += '&_remote=1';
    // send request
    console.log('HTTP GET: ' + url);
    this.log('HTTP GET: ' + url);
    return $.ajax({
      type: 'GET', url: url, data: { _unlock:(lock?lock:0) }, dataType: 'json',
@@ -5626,7 +5641,7 @@
    }
    // send request
    console.log('HTTP POST: ' + url);
    this.log('HTTP POST: ' + url);
    return $.ajax({
      type: 'POST', url: url, data: postdata, dataType: 'json',
@@ -5660,7 +5675,7 @@
    // if we get javascript code from server -> execute it
    if (response.exec) {
      console.log(response.exec);
      this.log(response.exec);
      eval(response.exec);
    }