Changeset edfe9173 in github


Ignore:
Timestamp:
Jun 30, 2010 3:37:48 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
3940ba6
Parents:
98570f6
Message:
  • Improved command() to call simple command functions directly
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/js/app.js

    r087c7dc redfe9173  
    485485        break; 
    486486 
    487       // misc list commands 
    488487      case 'list': 
    489488        if (this.task=='mail') { 
     
    505504        break; 
    506505 
    507  
    508       case 'listgroup': 
    509         this.list_contacts(props.source, props.id); 
    510         break; 
    511  
    512  
    513506      case 'load-headers': 
    514507        this.load_headers(obj); 
    515508        break; 
    516  
    517509 
    518510      case 'sort': 
     
    557549          this.purge_mailbox(this.env.mailbox); 
    558550        break; 
    559  
    560551 
    561552      // common commands used in multiple tasks 
     
    598589        break; 
    599590 
    600       case 'save-identity': 
    601591      case 'save': 
    602592        if (this.gui_objects.editform) { 
     
    880870        break; 
    881871 
    882       case 'remove-attachment': 
    883         this.remove_attachment(props); 
    884         break; 
    885  
    886872      case 'insert-sig': 
    887873        this.change_identity($("[name='_from']")[0], true); 
     
    928914        break; 
    929915 
    930       case 'add-contact': 
    931         this.add_contact(props); 
    932         break; 
    933  
    934916      // quicksearch 
    935917      case 'search': 
     
    952934        break; 
    953935 
    954       case 'group-create': 
    955         this.add_contact_group(props) 
    956         break; 
    957  
    958       case 'group-rename': 
    959         this.rename_contact_group(); 
    960         break; 
    961  
    962       case 'group-delete': 
    963         this.delete_contact_group(); 
     936      case 'listgroup': 
     937        this.list_contacts(props.source, props.id); 
    964938        break; 
    965939 
     
    989963        break; 
    990964 
    991       // collapse/expand folder 
    992       case 'collapse-folder': 
    993         if (props) 
    994           this.collapse_folder(props); 
    995         break; 
    996  
    997965      // user settings commands 
    998966      case 'preferences': 
     
    1004972        break; 
    1005973 
    1006       case 'delete-identity': 
    1007         this.delete_identity(); 
    1008  
    1009974      case 'folders': 
    1010975        this.goto_url('folders'); 
    1011976        break; 
    1012977 
    1013       case 'subscribe': 
    1014         this.subscribe_folder(props); 
    1015         break; 
    1016  
    1017       case 'unsubscribe': 
    1018         this.unsubscribe_folder(props); 
    1019         break; 
    1020  
    1021       case 'enable-threading': 
    1022         this.enable_threading(props); 
    1023         break; 
    1024  
    1025       case 'disable-threading': 
    1026         this.disable_threading(props); 
    1027         break; 
    1028  
    1029       case 'create-folder': 
    1030         this.create_folder(props); 
    1031         break; 
    1032  
    1033       case 'rename-folder': 
    1034         this.rename_folder(props); 
    1035         break; 
    1036  
    1037       case 'delete-folder': 
    1038         this.delete_folder(props); 
    1039         break; 
    1040  
     978      // unified command call (command name == function name) 
     979      default: 
     980        var func = command.replace('-', '_'); 
     981        alert(func); 
     982        if (this[func] && typeof this[func] == 'function') 
     983          this[func](props); 
     984        break; 
    1041985    } 
    1042986 
     
    37373681 
    37383682 
    3739   this.add_contact_group = function() 
     3683  this.group_create = function() 
    37403684  { 
    37413685    if (!this.gui_objects.folderlist || !this.env.address_sources[this.env.source].groups) 
     
    37543698  }; 
    37553699 
    3756   this.rename_contact_group = function() 
     3700  this.group_rename = function() 
    37573701  { 
    37583702    if (!this.env.group || !this.gui_objects.folderlist) 
     
    37743718  }; 
    37753719 
    3776   this.delete_contact_group = function() 
     3720  this.group_delete = function() 
    37773721  { 
    37783722    if (this.env.group) 
     
    38893833      var anchors = row.obj.getElementsByTagName('a'); 
    38903834      if (anchors[0]) 
    3891         anchors[0].onclick = function() { p.rename_folder(row.id); return false; }; 
     3835        anchors[0].onclick = function() { p.command('rename-folder', row.id); return false; }; 
    38923836      if (anchors[1]) 
    3893         anchors[1].onclick = function() { p.delete_folder(row.id); return false; }; 
     3837        anchors[1].onclick = function() { p.command('delete-folder', row.id); return false; }; 
    38943838      row.obj.onmouseover = function() { p.focus_subscription(row.id); }; 
    38953839      row.obj.onmouseout = function() { p.unfocus_subscription(row.id); }; 
     
    42584202  }; 
    42594203 
    4260   this.subscribe_folder = function(folder) 
     4204  this.subscribe = function(folder) 
    42614205  { 
    42624206    if (folder) 
     
    42644208  }; 
    42654209 
    4266   this.unsubscribe_folder = function(folder) 
     4210  this.unsubscribe = function(folder) 
    42674211  { 
    42684212    if (folder) 
Note: See TracChangeset for help on using the changeset viewer.