alecpl
2012-04-10 a274fb2e20215716389ec3709f0726b7002521f3
program/js/app.js
@@ -220,8 +220,7 @@
          $(this.gui_objects.qsearchbox).focusin(function() { rcmail.message_list.blur(); });
        }
        if (!this.env.flag_for_deletion && this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
          this.set_alttext('delete', 'movemessagetotrash');
        this.set_button_titles();
        this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward',
          'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download',
@@ -570,16 +569,14 @@
        break;
      case 'list':
        this.reset_qsearch();
        if (props && props != '')
          this.reset_qsearch();
        if (this.task == 'mail') {
          this.list_mailbox(props);
          if (this.env.trash_mailbox && !this.env.flag_for_deletion)
            this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage');
          this.set_button_titles();
        }
        else if (this.task == 'addressbook') {
        else if (this.task == 'addressbook')
          this.list_contacts(props);
        }
        break;
      case 'load-headers':
@@ -861,6 +858,9 @@
          url += '&_mbox='+urlencode(this.env.mailbox);
          if (props)
             url += '&_to='+urlencode(props);
          // also send search request so we can go back to search result after message is sent
          if (this.env.search_request)
            url += '&_search='+this.env.search_request;
        }
        // modify url if we're in addressbook
        else if (this.task == 'addressbook') {
@@ -959,7 +959,7 @@
      case 'send-attachment':
        // Reset the auto-save timer
        self.clearTimeout(this.save_timer);
        this.upload_file(props || this.gui_objects.uploadform);
        break;
@@ -2130,8 +2130,8 @@
    while (new_row) {
      if (new_row.nodeType == 1 && (r = this.message_list.rows[new_row.uid]) && r.unread_children) {
       this.message_list.expand_all(r);
       this.set_unread_children(r.uid);
        this.message_list.expand_all(r);
        this.set_unread_children(r.uid);
      }
      new_row = new_row.nextSibling;
    }
@@ -2316,38 +2316,38 @@
    row = row.obj.nextSibling;
    while (row) {
      if (row.nodeType == 1 && (r = rows[row.uid])) {
       if (!r.depth || r.depth <= depth)
         break;
        if (!r.depth || r.depth <= depth)
          break;
       r.depth--; // move left
        r.depth--; // move left
        // reset width and clear the content of a tab, icons will be added later
       $('#rcmtab'+r.uid).width(r.depth * 15).html('');
        $('#rcmtab'+r.uid).width(r.depth * 15).html('');
        if (!r.depth) { // a new root
         count++; // increase roots count
         r.parent_uid = 0;
         if (r.has_children) {
           // replace 'leaf' with 'collapsed'
           $('#rcmrow'+r.uid+' '+'.leaf:first')
          count++; // increase roots count
          r.parent_uid = 0;
          if (r.has_children) {
            // replace 'leaf' with 'collapsed'
            $('#rcmrow'+r.uid+' '+'.leaf:first')
              .attr('id', 'rcmexpando' + r.uid)
             .attr('class', (r.obj.style.display != 'none' ? 'expanded' : 'collapsed'))
             .bind('mousedown', {uid:r.uid, p:this},
               function(e) { return e.data.p.expand_message_row(e, e.data.uid); });
              .attr('class', (r.obj.style.display != 'none' ? 'expanded' : 'collapsed'))
              .bind('mousedown', {uid:r.uid, p:this},
                function(e) { return e.data.p.expand_message_row(e, e.data.uid); });
           r.unread_children = 0;
           roots.push(r);
         }
         // show if it was hidden
         if (r.obj.style.display == 'none')
           $(r.obj).show();
       }
       else {
         if (r.depth == depth)
           r.parent_uid = parent;
         if (r.unread && roots.length)
           roots[roots.length-1].unread_children++;
       }
     }
     row = row.nextSibling;
            r.unread_children = 0;
            roots.push(r);
          }
          // show if it was hidden
          if (r.obj.style.display == 'none')
            $(r.obj).show();
        }
        else {
          if (r.depth == depth)
            r.parent_uid = parent;
          if (r.unread && roots.length)
            roots[roots.length-1].unread_children++;
        }
      }
      row = row.nextSibling;
    }
    // update unread_children for roots
@@ -2366,13 +2366,13 @@
    while (row) {
      if (row.nodeType == 1 && (r = rows[row.uid])) {
       if (!r.depth && cnt)
         cnt--;
        if (!r.depth && cnt)
          cnt--;
        if (!cnt)
         this.message_list.remove_row(row.uid);
     }
     row = row.nextSibling;
          this.message_list.remove_row(row.uid);
      }
      row = row.nextSibling;
    }
  };
@@ -2569,6 +2569,9 @@
    // if there isn't a defined trash mailbox or we are in it
    // @TODO: we should check if defined trash mailbox exists
    else if (!trash || this.env.mailbox == trash)
      this.permanently_remove_messages();
    // we're in Junk folder and delete_junk is enabled
    else if (this.env.delete_junk && this.env.junk_mailbox && this.env.mailbox == this.env.junk_mailbox)
      this.permanently_remove_messages();
    // if there is a trash mailbox defined and we're not currently in it
    else {
@@ -2806,12 +2809,12 @@
        if (rows[uid].unread)
          r_uids[r_uids.length] = uid;
       if (this.env.skip_deleted) {
         count += this.update_thread(uid);
        if (this.env.skip_deleted) {
          count += this.update_thread(uid);
          this.message_list.remove_row(uid, (this.env.display_next && i == this.message_list.selection.length-1));
       }
       else
         this.set_message(uid, 'deleted', true);
        }
        else
          this.set_message(uid, 'deleted', true);
      }
    }
@@ -2869,6 +2872,19 @@
    return this.select_all_mode ? '*' : uids.join(',');
  };
  // Sets title of the delete button
  this.set_button_titles = function()
  {
    var label = 'deletemessage';
    if (!this.env.flag_for_deletion
      && this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox
      && (!this.env.delete_junk || !this.env.junk_mailbox || this.env.mailbox != this.env.junk_mailbox)
    )
      label = 'movemessagetotrash';
    this.set_alttext('delete', label);
  };
  /*********************************************************/
  /*********       mailbox folders methods         *********/
@@ -3001,7 +3017,7 @@
    obj[bw.ie || bw.safari || bw.chrome ? 'keydown' : 'keypress'](function(e) { return ref.ksearch_keydown(e, this, props); })
      .attr('autocomplete', 'off');
  };
  this.compose_recipient_select = function(list)
  {
    this.enable_command('add-recipient', list.selection.length > 0);
@@ -3010,7 +3026,7 @@
  this.compose_add_recipient = function(field)
  {
    var recipients = [], input = $('#_'+field);
    if (this.contact_list && this.contact_list.selection.length) {
      for (var id, n=0; n < this.contact_list.selection.length; n++) {
        id = this.contact_list.selection[n];
@@ -3443,8 +3459,9 @@
      if (this.env.loadingicon)
        content = '<img src="'+this.env.loadingicon+'" alt="" class="uploading" />'+content;
      if (this.env.cancelicon)
        content = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+ts+'\', \''+frame_name+'\');" href="#cancelupload" class="cancelupload"><img src="'+this.env.cancelicon+'" alt="" /></a>'+content;
      content = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+ts+'\', \''+frame_name+'\');" href="#cancelupload" class="cancelupload">'
        + (this.env.cancelicon ? '<img src="'+this.env.cancelicon+'" alt="" />' : this.get_label('cancel')) + '</a>' + content;
      this.add2attachment_list(ts, { name:'', html:content, classname:'uploading', complete:false });
      // upload progress support
@@ -6327,4 +6344,3 @@
rcube_webmail.prototype.addEventListener = rcube_event_engine.prototype.addEventListener;
rcube_webmail.prototype.removeEventListener = rcube_event_engine.prototype.removeEventListener;
rcube_webmail.prototype.triggerEvent = rcube_event_engine.prototype.triggerEvent;