svncommit
2006-06-19 1966c53255495890dd7f25c31bac73d97ecc3291
program/js/app.js
@@ -142,7 +142,13 @@
          }  
        if (this.env.action=='compose')
          {
          this.enable_command('add-attachment', 'send-attachment', 'send', true);
          if (this.env.spellcheck)
            this.enable_command('spellcheck', true);
     if (this.env.drafts_mailbox)
       this.enable_command('savedraft', true);
          }
          
        if (this.env.messagecount)
          this.enable_command('select-all', 'select-none', 'sort', 'expunge', true);
@@ -255,15 +261,29 @@
    };
  // reset last clicked if user clicks on anything other than the message table
  this.reset_click = function()
    {
  this.reset_click = function() {
    this.in_message_list = false;
    };
   for (var n=0; n<this.selection.length; n++) {
      id = this.selection[n];
      if (this.list_rows[id].obj) {
        this.set_classname(this.list_rows[id].obj, 'selected', false);
      this.set_classname(this.list_rows[id].obj, 'unfocused', true);
     }
    }
  };
   
  this.click_on_list = function(e)
    {
    if (!e)
      e = window.event;
    for (var n=0; n<this.selection.length; n++) {
      id = this.selection[n];
      if (this.list_rows[id].obj) {
        this.set_classname(this.list_rows[id].obj, 'selected', true);
      this.set_classname(this.list_rows[id].obj, 'unfocused', false);
     }
    }
    this.in_message_list = true;
    e.cancelBubble = true;
@@ -658,7 +678,17 @@
          {
          var uid = this.get_single_uid();
          if (uid && (!this.env.uid || uid != this.env.uid))
            this.show_message(uid);
       {
            if (this.env.mailbox==this.env.drafts_mailbox)
              {
              this.set_busy(true);
              location.href = this.env.comm_path+'&_action=compose&_draft_uid='+uid+'&_mbox='+escape(this.env.mailbox);
              }
            else
              {
              this.show_message(uid);
         }
       }
          }
        else if (this.task=='addressbook')
          {
@@ -815,9 +845,14 @@
      
      case 'compose':
        var url = this.env.comm_path+'&_action=compose';
        if (this.task=='mail' && this.env.mailbox==this.env.drafts_mailbox)
          {
          var uid = this.get_single_uid();
          url += '&_draft_uid='+uid+'&_mbox='+escape(this.env.mailbox);
          }
        // modify url if we're in addressbook
        if (this.task=='addressbook')
        else if (this.task=='addressbook')
          {
          url = this.get_task_url('mail', url);            
          var a_cids = new Array();
@@ -861,7 +896,25 @@
          parent.location.href = url;
        else
          location.href = url;
        break;
        break;
      case 'spellcheck':
        if (this.env.spellcheck && this.env.spellcheck.spellCheck)
          this.env.spellcheck.spellCheck(this.env.spellcheck.check_link);
        break;
      case 'savedraft':
        if (!this.gui_objects.messageform)
          break;
   // if saving Drafts is disabled in main.inc.php
   if (!this.env.drafts_mailbox)
     break;
        this.set_busy(true, 'savingmessage');
        var form = this.gui_objects.messageform;
        form.submit();
        break;
      case 'send':
        if (!this.gui_objects.messageform)
@@ -873,6 +926,7 @@
        // all checks passed, send message
        this.set_busy(true, 'sendingmessage');
        var form = this.gui_objects.messageform;
   form._draft.value='';
        form.submit();
        break;
@@ -1148,7 +1202,15 @@
    // row was double clicked
    if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && this.in_selection(id))
      {
      this.show_message(id);
      if (this.env.mailbox==this.env.drafts_mailbox)
        {
        this.set_busy(true);
        location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+escape(this.env.mailbox);
        }
      else
        {
        this.show_message(id);
        }
      return false;
      }
    else if (this.task=='addressbook')
@@ -1253,7 +1315,7 @@
      if (!this.in_selection(id))  // select row
        {
        this.selection[this.selection.length] = id;
        this.set_classname(this.list_rows[id].obj, 'selected', true);
        this.set_classname(this.list_rows[id].obj, 'selected', true);
        }
      else  // unselect row
        {
@@ -1262,6 +1324,7 @@
        var a_post = this.selection.slice(p+1, this.selection.length);
        this.selection = a_pre.concat(a_post);
        this.set_classname(this.list_rows[id].obj, 'selected', false);
        this.set_classname(this.list_rows[id].obj, 'unfocused', false);
        }
      selected = (this.selection.length==1);
      }
@@ -1269,8 +1332,18 @@
    // enable/disable commands for message
    if (this.task=='mail')
      {
      this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected);
      this.enable_command('delete', 'moveto', this.selection.length>0 ? true : false);
      if (this.env.mailbox==this.env.drafts_mailbox)
   {
   //alert(this.env.mailbox);
   //this.disable_command('reply', 'reply-all', 'forward', 'print', 'moveto');
   this.enable_command('show', selected);
   this.enable_command('delete', this.selection.length>0 ? true : false);
        }
      else
        {
        this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected);
        this.enable_command('delete', 'moveto', this.selection.length>0 ? true : false);
        }
      }
    else if (this.task=='addressbook')
      {
@@ -1334,9 +1407,10 @@
  this.clear_selection = function()
    {
    for(var n=0; n<this.selection.length; n++)
      if (this.list_rows[this.selection[n]])
      if (this.list_rows[this.selection[n]]) {
        this.set_classname(this.list_rows[this.selection[n]].obj, 'selected', false);
        this.set_classname(this.list_rows[this.selection[n]].obj, 'unfocused', false);
     }
    this.selection = new Array();    
    };
@@ -1882,12 +1956,15 @@
    var message = input_message ? input_message.value : '';
    var sig, p;
    if (!this.env.identity)
      this.env.identity = id
    // remove the 'old' signature
    if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity])
      {
      sig = this.env.signatures[this.env.identity];
      if (sig.indexOf('-- ')!=0)
        sig = '-- \n'+sig;
      if (sig.indexOf('--')!=0)
        sig = '--\n'+sig;
      p = message.lastIndexOf(sig);
      if (p>=0)
@@ -1898,8 +1975,8 @@
    if (this.env.signatures && this.env.signatures[id])
      {
      sig = this.env.signatures[id];
      if (sig.indexOf('-- ')!=0)
        sig = '-- \n'+sig;
      if (sig.indexOf('--')!=0)
        sig = '--\n'+sig;
      message += '\n'+sig;
      }
@@ -2075,6 +2152,7 @@
          highlight.removeAttribute('id');
          //highlight.removeAttribute('class');
          this.set_classname(highlight, 'selected', false);
          this.set_classname(highlight, 'unfocused', false);
          }
        if (next)
@@ -2813,8 +2891,10 @@
      var current_li = document.getElementById('rcmbx'+s_current);
      var mbox_li = document.getElementById('rcmbx'+s_mbox);
      
      if (current_li)
      if (current_li) {
        this.set_classname(current_li, 'selected', false);
        this.set_classname(current_li, 'unfocused', false);
        }
      if (mbox_li)
        this.set_classname(mbox_li, 'selected', true);
      }