alecpl
2011-02-25 b649c49e64a487ac8ad347aed42336dec2e74cd7
program/js/app.js
@@ -331,7 +331,7 @@
            this.selectedIndex = 0;
          });
          $("input[type='text']").first().focus();
          $("input[type='text']:visible").first().focus();
        }
        else if (this.gui_objects.qsearchbox) {
          this.enable_command('search', 'reset-search', 'moveto', true);
@@ -646,7 +646,7 @@
              input_name.focus();
              break;
            }
            else if (input_email.length && !rcube_check_email(input_email.val())) {
            else if (this.task == 'settings' && input_email.length && !rcube_check_email(input_email.val())) {
              alert(this.get_label('noemailwarning'));
              input_email.focus();
              break;
@@ -3190,7 +3190,7 @@
    // create hidden iframe and post upload form
    if (send) {
      this.async_upload_form(form, 'upload', function(e) {
      var frame_name = this.async_upload_form(form, 'upload', function(e) {
        var d, content = '';
        try {
          if (this.contentDocument) {
@@ -3199,7 +3199,7 @@
            d = this.contentWindow.document;
          }
          content = d.childNodes[0].innerHTML;
        } catch (e) {}
        } catch (err) {}
        if (!content.match(/add2attachment/) && (!bw.opera || (rcmail.env.uploadframe && rcmail.env.uploadframe == e.data.ts))) {
          if (!content.match(/display_message/))
@@ -3212,7 +3212,9 @@
      });
      // display upload indicator and cancel button
      var content = this.get_label('uploading');
      var content = this.get_label('uploading'),
        ts = frame_name.replace(/^rcmupload/, '');
      if (this.env.loadingicon)
        content = '<img src="'+this.env.loadingicon+'" alt="" />'+content;
      if (this.env.cancelicon)
@@ -3486,15 +3488,14 @@
    if (q == this.ksearch_value)
      return;
    if (q.length < min) {
    if (q.length && 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);
        this.env.acinfo = this.display_message(
          this.get_label('autocompletechars').replace('$min', min));
      }
      return;
    }
    else if (this.env.acinfo && q.length == min) {
    else if (this.env.acinfo) {
      this.hide_message(this.env.acinfo);
    }
@@ -3781,6 +3782,9 @@
  // update a contact record in the list
  this.update_contact_row = function(cid, cols_arr, newcid)
  {
    cid = String(cid).replace(this.identifier_expr, '_');
    newcid = String(newcid).replace(this.identifier_expr, '_');
    var row;
    if (this.contact_list.rows[cid] && (row = this.contact_list.rows[cid].obj)) {
      for (var c=0; c<cols_arr.length; c++)
@@ -3813,7 +3817,7 @@
      even = rowcount%2,
      row = document.createElement('tr');
    row.id = 'rcmrow'+cid;
    row.id = 'rcmrow'+String(cid).replace(this.identifier_expr, '_');
    row.className = 'contact '+(even ? 'even' : 'odd');
    if (this.contact_list.in_selection(cid))
@@ -3945,9 +3949,10 @@
    this.env.contactfolders[key] = this.env.contactgroups[key] = prop;
    var link = $('<a>').attr('href', '#')
      .attr('rel', prop.source+':'+prop.id)
      .bind('click', function() { return rcmail.command('listgroup', prop, this);})
      .html(prop.name);
    var li = $('<li>').attr('id', 'rcmli'+key)
    var li = $('<li>').attr('id', 'rcmli'+key.replace(this.identifier_expr, '_'))
      .addClass('contactgroup')
      .append(link)
      .insertAfter(this.get_folder_li(prop.source));
@@ -3960,13 +3965,33 @@
  {
    this.reset_add_input();
    var key = 'G'+prop.source+prop.id, link, li = this.get_folder_li(key);
    var key = 'G'+prop.source+prop.id,
      li = this.get_folder_li(key),
      link;
    if (li && (link = li.firstChild) && link.tagName.toLowerCase() == 'a')
    // group ID has changed, replace link node and identifiers
    if (li && prop.newid) {
      var newkey = 'G'+prop.source+prop.newid;
      li.id = String('rcmli'+newkey).replace(this.identifier_expr, '_');
      this.env.contactfolders[newkey] = this.env.contactfolders[key];
      this.env.group = prop.newid;
      var newprop = $.extend({}, prop);
      newprop.id = prop.newid;
      newprop.type = 'group';
      link = $('<a>').attr('href', '#')
        .attr('rel', prop.source+':'+prop.newid)
        .bind('click', function() { return rcmail.command('listgroup', newprop, this);})
        .html(prop.name);
      $(li).children().replaceWith(link);
    }
    // update displayed group name
    else if (li && (link = li.firstChild) && link.tagName.toLowerCase() == 'a')
      link.innerHTML = prop.name;
    this.env.contactfolders[key].name = this.env.contactgroups[key].name = prop.name;
    this.triggerEvent('group_update', { id:prop.id, source:prop.source, name:prop.name, li:li[0] });
    this.triggerEvent('group_update', { id:prop.id, source:prop.source, name:prop.name, li:li[0], newid:prop.newid });
  };
@@ -3977,7 +4002,7 @@
    
    elem.focus(function(){ ref.focus_textfield(this); })
      .blur(function(){ ref.blur_textfield(this); })
      .each(function(){ this._placeholder = ref.env.coltypes[col].label; ref.blur_textfield(this); });
      .each(function(){ this._placeholder = this.title = ref.env.coltypes[col].label; ref.blur_textfield(this); });
  };
  this.insert_edit_field = function(col, section, menu)
@@ -5350,8 +5375,8 @@
  // post the given form to a hidden iframe
  this.async_upload_form = function(form, action, onload)
  {
    var ts = new Date().getTime();
    var frame_name = 'rcmupload'+ts;
    var ts = new Date().getTime(),
      frame_name = 'rcmupload'+ts;
    // have to do it this way for IE
    // otherwise the form will be posted to a new window
@@ -5376,6 +5401,8 @@
    form.action = this.url(action, { _uploadid:ts });
    form.setAttribute('enctype', 'multipart/form-data');
    form.submit();
    return frame_name;
  };
  
  // starts interval for keep-alive/check-recent signal