Aleksander Machniak
2014-12-15 376cbfd4f2dfcf455717409b70d9d056cbeb08b1
program/js/app.js
@@ -187,6 +187,11 @@
    if (this.env.permaurl)
      this.enable_command('permaurl', 'extwin', true);
    // initialize html editor
    if (this.env.html_editor_init && window.rcmail_editor_init) {
      rcmail_editor_init(this.env.html_editor_init);
    }
    switch (this.task) {
      case 'mail':
@@ -1331,8 +1336,10 @@
    var url = this.get_task_url(task);
    if (task == 'mail')
      url += '&_mbox=INBOX';
    else if (task == 'logout' && !this.env.server_error)
    else if (task == 'logout' && !this.env.server_error) {
      url += '&_token=' + this.env.request_token;
      this.clear_compose_data();
    }
    this.redirect(url);
  };
@@ -1342,7 +1349,10 @@
    if (!url)
      url = this.env.comm_path;
    return url.replace(/_task=[a-z0-9_-]+/i, '_task='+task);
    if (url.match(/[?&]_task=[a-zA-Z0-9_-]+/))
        return url.replace(/_task=[a-zA-Z0-9_-]+/, '_task=' + task);
    else
        return url.replace(/\?.*$/, '') + '?_task=' + task;
  };
  this.reload = function(delay)
@@ -2291,7 +2301,7 @@
  // expand all threads with unread children
  this.expand_unread = function()
  {
    var r, tbody = this.gui_objects.messagelist.tBodies[0],
    var r, tbody = this.message_list.tbody,
      new_row = tbody.firstChild;
    while (new_row) {
@@ -3123,7 +3133,7 @@
    if (!this.gui_objects.messageform)
      return false;
    var input_from = $("[name='_from']"),
    var i, pos, input_from = $("[name='_from']"),
      input_to = $("[name='_to']"),
      input_subject = $("input[name='_subject']"),
      input_message = $("[name='_message']").get(0),
@@ -3152,16 +3162,23 @@
    // init live search events
    this.init_address_input_events(input_to, ac_props);
    for (var i in ac_fields) {
    for (i in ac_fields) {
      this.init_address_input_events($("[name='_"+ac_fields[i]+"']"), ac_props);
    }
    if (!html_mode) {
      this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length);
      pos = this.env.top_posting ? 0 : input_message.value.length;
      this.set_caret_pos(input_message, pos);
      // add signature according to selected identity
      // if we have HTML editor, signature is added in callback
      if (input_from.prop('type') == 'select-one') {
        this.change_identity(input_from[0]);
      }
      // scroll to the bottom of the textarea (#1490114)
      if (pos) {
        $(input_message).scrollTop(input_message.scrollHeight);
      }
    }
@@ -3427,6 +3444,8 @@
    }
    else if (this.html2plain(tinyMCE.get(props.id).getContent(), props.id))
      tinyMCE.execCommand('mceRemoveControl', false, props.id);
    else
      return false;
    return true;
  };
@@ -3861,6 +3880,16 @@
    if (!show_sig)
      show_sig = this.env.show_sig;
    var id = obj.options[obj.selectedIndex].value;
    // enable manual signature insert
    if (this.env.signatures && this.env.signatures[id]) {
      this.enable_command('insert-sig', true);
      this.env.compose_commands.push('insert-sig');
    }
    else
      this.enable_command('insert-sig', false);
    // first function execution
    if (!this.env.identities_initialized) {
      this.env.identities_initialized = true;
@@ -3871,7 +3900,6 @@
    }
    var cursor_pos, p = -1,
      id = obj.options[obj.selectedIndex].value,
      input_message = $("[name='_message']"),
      message = input_message.val(),
      is_html = ($("input[name='_is_html']").val() == '1'),
@@ -3911,14 +3939,6 @@
      if (old_val || new_val)
        input.val(input_val).change();
    });
    // enable manual signature insert
    if (this.env.signatures && this.env.signatures[id]) {
      this.enable_command('insert-sig', true);
      this.env.compose_commands.push('insert-sig');
    }
    else
      this.enable_command('insert-sig', false);
    if (!is_html) {
      // remove the 'old' signature
@@ -4688,6 +4708,7 @@
  this.list_contacts = function(src, group, page)
  {
    var win, folder, url = {},
      refresh = src === undefined && group === undefined && page === undefined,
      target = window;
    if (!src)
@@ -4700,7 +4721,7 @@
      page = this.env.current_page = 1;
      this.reset_qsearch();
    }
    else if (group != this.env.group)
    else if (!refresh && group != this.env.group)
      page = this.env.current_page = 1;
    if (this.env.search_id)
@@ -4837,6 +4858,9 @@
      if (this.env.group)
        url._gid = this.env.group;
      if (this.env.search_request)
        url._search = this.env.search_request;
      url._action = action;
      url._source = this.env.source;
      url._cid = cid;