Changeset 14259ce in github


Ignore:
Timestamp:
May 25, 2010 4:42:39 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:
1a4fa6f
Parents:
3831efb
Message:
  • fixed parse error
  • support arguments of type object in enable_command()
  • simplify setting of state of message commands
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/js/app.js

    r3831efb r14259ce  
    200200          this.set_alttext('delete', 'movemessagetotrash'); 
    201201 
     202        this.env.message_commands = ['show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete', 
     203          'open', 'mark', 'edit', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers']; 
     204 
    202205        if (this.env.action=='show' || this.env.action=='preview') { 
    203           this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete', 
    204             'open', 'mark', 'edit', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers', true); 
     206          this.enable_command(this.env.message_commands, true); 
    205207 
    206208          if (this.env.next_uid) { 
     
    10481050  }; 
    10491051 
    1050   // set command enabled or disabled 
     1052  // set command(s) enabled or disabled 
    10511053  this.enable_command = function() 
    10521054  { 
    1053     var args = arguments, len = args.length; 
    1054     if (!len) 
    1055       return -1; 
    1056  
    1057     var command, enable = args[len-1]; 
     1055    var args = arguments, len = args.length, 
     1056      command, enable = args[len-1]; 
    10581057 
    10591058    for (var n=0, len=len-1; n<len; n++) { 
     1059      if (typeof args[n] === 'object') { 
     1060        for (var i in args[n]) 
     1061          this.enable_command(args[n][i], enable); 
     1062        continue; 
     1063      } 
    10601064      command = args[n]; 
    10611065      this.commands[command] = enable; 
    10621066      this.set_button(command, (enable ? 'act' : 'pas')); 
    10631067    } 
    1064     return true; 
    10651068  }; 
    10661069 
     
    13991402    var selected = list.get_single_selection() != null; 
    14001403 
     1404    this.enable_command(this.env.message_commands, selected); 
    14011405    // Hide certain command buttons when Drafts folder is selected 
    1402     this.enable_command('reply', 'reply-all', 'forward', this.env.mailbox == this.env.drafts_mailbox ? false : selected); 
    1403     this.enable_command('show', 'print', 'open', 'edit', 'download', 'viewsource', selected); 
     1406    if (selected && this.env.mailbox == this.env.drafts_mailbox) { 
     1407      this.enable_command('reply', 'reply-all', 'forward', false); 
     1408    } 
     1409    // Multi-message commands 
    14041410    this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); 
    14051411 
     
    23262332 
    23272333    // Hide message command buttons until a message is selected 
    2328     this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'edit', 'viewsource', 'download', false); 
     2334    this.enable_command(this.env.message_commands, false); 
    23292335 
    23302336    this._with_selected_messages('moveto', lock, add_url); 
     
    49314937      for (var i=0; i < response.callbacks.length; i++) 
    49324938        this.triggerEvent(response.callbacks[i][0], response.callbacks[i][1]); 
     4939    } 
    49334940 
    49344941    // process the response data according to the sent action 
     
    49454952        if (this.env.action == 'show') { 
    49464953          // re-enable commands on move/delete error 
    4947           this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'edit', 'viewsource', 'download', true); 
     4954          this.enable_command(this.env.message_commands, true); 
    49484955        } 
    49494956        break; 
     
    49564963            this.show_contentframe(false); 
    49574964          // disable commands useless when mailbox is empty 
    4958           this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete', 
    4959             'mark', 'viewsource', 'open', 'edit', 'download', 'print', 'load-attachment', 
     4965          this.enable_command(this.env.message_commands, 
    49604966            'purge', 'expunge', 'select-all', 'select-none', 'sort', 
    49614967            'expand-all', 'expand-unread', 'collapse-all', false); 
Note: See TracChangeset for help on using the changeset viewer.