alecpl
2009-05-30 dc2fc082d372cc58f6d660d89fa19788be0d4c34
program/js/app.js
@@ -165,7 +165,7 @@
          this.message_list.addEventListener('select', function(o){ p.msglist_select(o); });
          this.message_list.addEventListener('dragstart', function(o){ p.drag_start(o); });
          this.message_list.addEventListener('dragmove', function(o, e){ p.drag_move(e); });
          this.message_list.addEventListener('dragend', function(o){ p.drag_active = false; });
          this.message_list.addEventListener('dragend', function(o, e){ p.drag_end(e); });
          document.onmouseup = function(e){ return p.doc_mouse_up(e); };
          this.message_list.init();
@@ -188,7 +188,9 @@
        
        if (this.env.action=='show' || this.env.action=='preview')
          {
          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', 'print', 'load-attachment', 'load-headers', true);
          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete',
       'open', 'mark', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers', true);
          if (this.env.next_uid)
            {
            this.enable_command('nextmessage', true);
@@ -198,6 +200,13 @@
            {
            this.enable_command('previousmessage', true);
            this.enable_command('firstmessage', true);
            }
     if (this.env.blockedobjects)
            {
            if (this.gui_objects.remoteobjectsmsg)
              this.gui_objects.remoteobjectsmsg.style.display = 'block';
            this.enable_command('load-images', 'always-load', true);
            }
          }
@@ -209,13 +218,6 @@
          {
          this.enable_command('compose', 'add-contact', false);
          parent.rcmail.show_contentframe(true);
          }
        if ((this.env.action=='show' || this.env.action=='preview') && this.env.blockedobjects)
          {
          if (this.gui_objects.remoteobjectsmsg)
            this.gui_objects.remoteobjectsmsg.style.display = 'block';
          this.enable_command('load-images', 'always-load', true);
          }
        if (this.env.action=='compose')
@@ -279,7 +281,7 @@
          this.contact_list.addEventListener('select', function(o){ p.contactlist_select(o); });
          this.contact_list.addEventListener('dragstart', function(o){ p.drag_start(o); });
          this.contact_list.addEventListener('dragmove', function(o, e){ p.drag_move(e); });
          this.contact_list.addEventListener('dragend', function(o){ p.drag_active = false; });
          this.contact_list.addEventListener('dragend', function(o, e){ p.drag_end(e); });
          this.contact_list.init();
          if (this.env.cid)
@@ -484,7 +486,7 @@
  this.init_address_input_events = function(obj)
    {
    var handler = function(e){ return ref.ksearch_keypress(e,this); };
    obj.bind((bw.safari ? 'keydown' : 'keypress'), handler);
    obj.bind((bw.safari || bw.ie ? 'keydown' : 'keypress'), handler);
    obj.attr('autocomplete', 'off');
    };
@@ -565,7 +567,16 @@
          return true;
        else if (this.env.permaurl)
          parent.location.href = this.env.permaurl;
          break;
        break;
      case 'open':
        var uid;
        if (uid = this.get_single_uid())
        {
          obj.href = '?_task='+this.env.task+'&_action=show&_mbox='+urlencode(this.env.mailbox)+'&_uid='+uid;
          return true;
        }
        break;
      // misc list commands
      case 'list':
@@ -992,10 +1003,16 @@
        var uid;
        if (uid = this.get_single_uid())
          {
          ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox));
          ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox));
          if (this.sourcewin)
            window.setTimeout(function(){ ref.sourcewin.focus(); }, 20);
          }
        break;
      case 'download':
        var uid;
        if (uid = this.get_single_uid())
          this.goto_url('viewsource', '&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+'&_save=1');
        break;
      case 'add-contact':
@@ -1251,6 +1268,21 @@
    }
  };
  this.drag_end = function(e)
  {
    this.drag_active = false;
    // over the folders
    if (this.gui_objects.folderlist && this.env.folder_coords) {
      for (var k in this.env.folder_coords) {
        if (k == this.env.last_folder_target) {
          $(this.get_folder_li(k)).removeClass('droptarget');
          this.env.last_folder_target = null;
        }
      }
    }
  };
  this.drag_move = function(e)
  {
    if (this.gui_objects.folderlist && this.env.folder_coords) {
@@ -1357,12 +1389,12 @@
    if (this.env.mailbox == this.env.drafts_mailbox)
      {
      this.enable_command('reply', 'reply-all', 'forward', false);
      this.enable_command('show', 'print', selected);
      this.enable_command('show', 'print', 'open', 'download', 'viewsource', selected);
      this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
      }
    else
      {
      this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected);
      this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'open', 'download', 'viewsource', selected);
      this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
      }
@@ -1765,7 +1797,7 @@
      this.show_contentframe(false);
    // Hide message command buttons until a message is selected
    this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', false);
    this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'viewsource', 'download', false);
    this._with_selected_messages('moveto', lock, add_url, (this.env.flag_for_deletion ? false : true));
    };
@@ -1777,7 +1809,7 @@
    // exit if no mailbox specified or if selection is empty
    if (!this.env.uid && !selection.length)
        return;
      return;
    // if there is a trash mailbox defined and we're not currently in it:
    if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase() != String(this.env.trash_mailbox).toLowerCase())
@@ -1798,8 +1830,8 @@
    else if (!this.env.trash_mailbox && this.env.flag_for_deletion)
      {
      this.mark_message('delete');
      if(this.env.action=="show")
        this.command('nextmessage','',this);
      if (this.env.action == 'show')
        this.command('nextmessage', '', this);
      else if (selection.length == 1)
        this.message_list.select_next();
      }
@@ -1852,6 +1884,9 @@
    // also send search request to get the right messages 
    if (this.env.search_request) 
      add_url += '&_search='+this.env.search_request;
    if (this.env.next_uid)
      add_url += '&_next_uid='+this.env.next_uid;
    // send request to server
    this.http_post(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock);
@@ -3897,9 +3932,10 @@
        }
      
      case 'moveto':
        if (this.env.action == 'show')
          this.command('list');
        else if (this.message_list)
        if (this.env.action == 'show') {
     // re-enable commands on move/delete error
     this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'viewsource', 'download', true);
        } else if (this.message_list)
          this.message_list.init();
        break;
        
@@ -3910,8 +3946,9 @@
          if (this.env.contentframe)
            this.show_contentframe(false);
          // disable commands useless when mailbox is empty
          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource',
            'print', 'load-attachment', 'purge', 'expunge', 'select-all', 'select-none', 'sort', false);
          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete',
       'mark', 'viewsource', 'open', 'download', 'print', 'load-attachment',
       'purge', 'expunge', 'select-all', 'select-none', 'sort', false);
        }
        break;