alecpl
2010-11-08 f94639f7bfd0bd3fdbe074dc4fb290a8265f6373
program/js/app.js
@@ -1802,28 +1802,28 @@
    if (!id)
      return;
    var add_url = '',
      target = window,
      action = preview ? 'preview': 'show';
    var target = window,
      action = preview ? 'preview': 'show',
      url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox);
    if (preview && this.env.contentframe && window.frames && window.frames[this.env.contentframe]) {
      target = window.frames[this.env.contentframe];
      add_url = '&_framed=1';
      url += '&_framed=1';
    }
    if (safe)
      add_url = '&_safe=1';
      url += '&_safe=1';
    // also send search request to get the right messages
    if (this.env.search_request)
      add_url += '&_search='+this.env.search_request;
      url += '&_search='+this.env.search_request;
    var url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url;
    if (action == 'preview' && String(target.location.href).indexOf(url) >= 0)
      this.show_contentframe(true);
    else {
      if (!this.env.frame_lock)
        this.env.frame_lock = this.set_busy(true, 'loading');
      if (!this.env.frame_lock) {
        (parent.rcmail ? parent.rcmail : this).env.frame_lock = this.set_busy(true, 'loading');
      }
      target.location.href = this.env.comm_path+url;
      // mark as read and change mbox unread counter
@@ -3426,14 +3426,14 @@
      return;
    // get cursor pos
    var inp_value = this.ksearch_input.value;
    var cpos = this.get_caret_pos(this.ksearch_input);
    var p = inp_value.lastIndexOf(this.ksearch_value, cpos);
    var inp_value = this.ksearch_input.value,
      cpos = this.get_caret_pos(this.ksearch_input),
      p = inp_value.lastIndexOf(this.ksearch_value, cpos),
      insert = '',
    // replace search string with full address
    var pre = this.ksearch_input.value.substring(0, p);
    var end = this.ksearch_input.value.substring(p+this.ksearch_value.length, this.ksearch_input.value.length);
    var insert = '';
      // replace search string with full address
      pre = inp_value.substring(0, p),
      end = inp_value.substring(p+this.ksearch_value.length, inp_value.length);
    // insert all members of a group
    if (typeof this.env.contacts[id] == 'object' && this.env.contacts[id].id) {
@@ -3465,6 +3465,7 @@
  this.ksearch_get_results = function()
  {
    var inp_value = this.ksearch_input ? this.ksearch_input.value : null;
    if (inp_value === null)
      return;
@@ -3472,9 +3473,10 @@
      this.ksearch_pane.hide();
    // get string from current cursor pos to last comma
    var cpos = this.get_caret_pos(this.ksearch_input);
    var p = inp_value.lastIndexOf(',', cpos-1);
    var q = inp_value.substring(p+1, cpos);
    var cpos = this.get_caret_pos(this.ksearch_input),
      p = inp_value.lastIndexOf(',', cpos-1),
      q = inp_value.substring(p+1, cpos),
      min = this.env.autocomplete_min_length;
    // trim query string
    q = q.replace(/(^\s+|\s+$)/g, '');
@@ -3483,6 +3485,18 @@
    if (q == this.ksearch_value)
      return;
    if (q.length < min) {
      if (!this.env.acinfo) {
        var label = this.get_label('autocompletechars');
        label = label.replace('$min', min);
        this.env.acinfo = this.display_message(label);
      }
      return;
    }
    else if (this.env.acinfo && q.length == min) {
      this.hide_message(this.env.acinfo);
    }
    var old_value = this.ksearch_value;
    this.ksearch_value = q;