alecpl
2011-07-08 7f554cfaecb52dbbc21c0c905bbc9e181db20b60
program/js/app.js
@@ -164,7 +164,7 @@
    }
    // enable general commands
    this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', true);
    this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', 'undo', true);
    if (this.env.permaurl)
      this.enable_command('permaurl', true);
@@ -209,7 +209,7 @@
          $(this.gui_objects.qsearchbox).focusin(function() { rcmail.message_list.blur(); });
        }
        if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
        if (!this.env.flag_for_deletion && this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
          this.set_alttext('delete', 'movemessagetotrash');
        this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward',
@@ -411,7 +411,7 @@
    // show message
    if (this.pending_message)
      this.display_message(this.pending_message[0], this.pending_message[1]);
      this.display_message(this.pending_message[0], this.pending_message[1], this.pending_message[2]);
    // map implicit containers
    if (this.gui_objects.folderlist)
@@ -526,7 +526,7 @@
          this.list_mailbox(props);
          if (this.env.trash_mailbox)
          if (this.env.trash_mailbox && !this.env.flag_for_deletion)
            this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage');
        }
        else if (this.task == 'addressbook') {
@@ -1046,6 +1046,10 @@
        this.goto_url('settings/' + command);
        break;
      case 'undo':
        this.http_request('undo', '', this.display_message('', 'loading'));
        break;
      // unified command call (command name == function name)
      default:
        var func = command.replace(/-/g, '_');
@@ -1296,7 +1300,7 @@
      var toffset = -moffset-boffset;
      var li, div, pos, mouse, check, oldclass,
        layerclass = 'draglayernormal';
      if (this.contact_list && this.contact_list.draglayer)
        oldclass = this.contact_list.draglayer.attr('class');
@@ -3512,6 +3516,7 @@
    var inp_value = this.ksearch_input.value,
      cpos = this.get_caret_pos(this.ksearch_input),
      p = inp_value.lastIndexOf(this.ksearch_value, cpos),
      trigger = false,
      insert = '',
      // replace search string with full address
@@ -3523,10 +3528,12 @@
      insert += this.env.contacts[id].name + ', ';
      this.group2expand = $.extend({}, this.env.contacts[id]);
      this.group2expand.input = this.ksearch_input;
      this.http_request('group-expand', '_source='+urlencode(this.env.contacts[id].source)+'&_gid='+urlencode(this.env.contacts[id].id), false);
      this.http_request('mail/group-expand', '_source='+urlencode(this.env.contacts[id].source)+'&_gid='+urlencode(this.env.contacts[id].id), false);
    }
    else if (typeof this.env.contacts[id] === 'string')
    else if (typeof this.env.contacts[id] === 'string') {
      insert = this.env.contacts[id] + ', ';
      trigger = true;
    }
    this.ksearch_input.value = pre + insert + end;
@@ -3534,12 +3541,16 @@
    cpos = p+insert.length;
    if (this.ksearch_input.setSelectionRange)
      this.ksearch_input.setSelectionRange(cpos, cpos);
    if (trigger)
      this.triggerEvent('autocomplete_insert', { field:this.ksearch_input, insert:insert });
  };
  this.replace_group_recipients = function(id, recipients)
  {
    if (this.group2expand && this.group2expand.id == id) {
      this.group2expand.input.value = this.group2expand.input.value.replace(this.group2expand.name, recipients);
      this.triggerEvent('autocomplete_insert', { field:this.group2expand.input, insert:recipients });
      this.group2expand = null;
    }
  };
@@ -3591,7 +3602,7 @@
      return;
    var lock = this.display_message(this.get_label('searching'), 'loading');
    this.http_post('autocomplete', '_search='+urlencode(q), lock);
    this.http_post('mail/autocomplete', '_search='+urlencode(q), lock);
  };
  this.ksearch_query_results = function(results, search)
@@ -4980,7 +4991,7 @@
    if (elem._placeholder && (!$elem.val() || $elem.val() == elem._placeholder))
      $elem.addClass('placeholder').attr('spellcheck', false).val(elem._placeholder);
  };
  // write to the document/window title
  this.set_pagetitle = function(title)
  {
@@ -4989,27 +5000,29 @@
  };
  // display a system message, list of types in common.css (below #message definition)
  this.display_message = function(msg, type)
  this.display_message = function(msg, type, timeout)
  {
    // pass command to parent window
    if (this.is_framed())
      return parent.rcmail.display_message(msg, type);
      return parent.rcmail.display_message(msg, type, timeout);
    if (!this.gui_objects.message) {
      // save message in order to display after page loaded
      if (type != 'loading')
        this.pending_message = new Array(msg, type);
        this.pending_message = new Array(msg, type, timeout);
      return false;
    }
    type = type ? type : 'notice';
    var ref = this,
      key = msg,
      key = String(msg).replace(this.identifier_expr, '_'),
      date = new Date(),
      id = type + date.getTime(),
      id = type + date.getTime();
    if (!timeout)
      timeout = this.message_time * (type == 'error' || type == 'warning' ? 2 : 1);
    if (type == 'loading') {
      key = 'loading';
      timeout = this.env.request_timeout * 1000;
@@ -5679,7 +5692,7 @@
      if (!field.length) {
        field = $('<input>').attr({type: 'hidden', name: fname});
        field.appendTo(form);
        field.prependTo(form);
      }
      field.val(ts);