Aleksander Machniak
2012-05-30 528c78a6dae632df624fb74909185dc3858c61d4
Code cleanup, more object-like syntax when building URLs
1 files modified
23 ■■■■ changed files
program/js/app.js 23 ●●●● patch | view | raw | blame | history
program/js/app.js
@@ -631,7 +631,7 @@
          uid = this.get_single_uid();
          if (uid && (!this.env.uid || uid != this.env.uid)) {
            if (this.env.mailbox == this.env.drafts_mailbox)
              this.goto_url('compose', '_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox), true);
              this.goto_url('compose', { _draft_uid: uid, _mbox: this.env.mailbox }, true);
            else
              this.show_message(uid);
          }
@@ -658,8 +658,9 @@
        else if (this.task=='settings' && props)
          this.load_identity(props, 'edit-identity');
        else if (this.task=='mail' && (cid = this.get_single_uid())) {
          url = (this.env.mailbox == this.env.drafts_mailbox) ? '_draft_uid=' : '_uid=';
          this.goto_url('compose', url+cid+'&_mbox='+urlencode(this.env.mailbox), true);
          url = { _mbox: this.env.mailbox };
          url[this.env.mailbox == this.env.drafts_mailbox ? '_draft_uid' : '_uid'] = cid;
          this.goto_url('compose', url, true);
        }
        break;
@@ -984,12 +985,12 @@
      case 'reply-list':
      case 'reply':
        if (uid = this.get_single_uid()) {
          url = '_reply_uid='+uid+'&_mbox='+urlencode(this.env.mailbox);
          url = {_reply_uid: uid, _mbox: this.env.mailbox};
          if (command == 'reply-all')
            // do reply-list, when list is detected and popup menu wasn't used 
            url += '&_all=' + (!props && this.commands['reply-list'] ? 'list' : 'all');
            url._all = (!props && this.commands['reply-list'] ? 'list' : 'all');
          else if (command == 'reply-list')
            url += '&_all=list';
            url._all = list;
          this.goto_url('compose', url, true);
        }
@@ -998,9 +999,9 @@
      case 'forward-attachment':
      case 'forward':
        if (uid = this.get_single_uid()) {
          url = '_forward_uid='+uid+'&_mbox='+urlencode(this.env.mailbox);
          url = { _forward_uid: uid, _mbox: this.env.mailbox };
          if (command == 'forward-attachment' || (!props && this.env.forward_attachment))
            url += '&_attachment=1';
            url._attachment = 1;
          this.goto_url('compose', url, true);
        }
        break;
@@ -1026,7 +1027,7 @@
      case 'download':
        if (uid = this.get_single_uid())
          this.goto_url('viewsource', '&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+'&_save=1');
          this.goto_url('viewsource', { _uid: uid, _mbox: this.env.mailbox, _save: 1 });
        break;
      // quicksearch
@@ -1580,7 +1581,7 @@
    var uid = list.get_single_selection();
    if (uid && this.env.mailbox == this.env.drafts_mailbox)
      this.goto_url('compose', '_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox), true);
      this.goto_url('compose', { _draft_uid: uid, _mbox: this.env.mailbox }, true);
    else if (uid)
      this.show_message(uid, false, false);
  };
@@ -4925,7 +4926,7 @@
    // submit request with appended token
    if (confirm(this.get_label('deleteidentityconfirm')))
      this.goto_url('delete-identity', '_iid='+id+'&_token='+this.env.request_token, true);
      this.goto_url('delete-identity', { _iid: id, _token: this.env.request_token }, true);
    return true;
  };