Changeset 6080 in subversion


Ignore:
Timestamp:
Apr 13, 2012 9:50:54 AM (13 months ago)
Author:
alec
Message:
  • Code improvements, handle post/get request arguments as objects
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/app.js

    r6066 r6080  
    232232 
    233233          if (this.env.action == 'show') { 
    234             this.http_request('pagenav', '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox) 
    235               + (this.env.search_request ? '&_search='+this.env.search_request : ''), 
     234            this.http_request('pagenav', {_uid: this.env.uid, _mbox: this.env.mailbox, _search: this.env.search_request}, 
    236235              this.display_message('', 'loading')); 
    237236          } 
     
    282281          this.env.unread_counts = {}; 
    283282          this.gui_objects.folderlist = this.gui_objects.mailboxlist; 
    284           this.http_request('getunread', ''); 
     283          this.http_request('getunread'); 
    285284        } 
    286285 
     
    301300        // ask user to send MDN 
    302301        if (this.env.mdn_request && this.env.uid) { 
    303           var mdnurl = '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox); 
    304           if (confirm(this.get_label('mdnrequest'))) 
    305             this.http_post('sendmdn', mdnurl); 
    306           else 
    307             this.http_post('mark', mdnurl+'&_flag=mdnsent'); 
     302          var postact = 'sendmdn', 
     303            postdata = {_uid: this.env.uid, _mbox: this.env.mailbox}; 
     304          if (!confirm(this.get_label('mdnrequest'))) { 
     305            postdata._flag = 'mdnsent'; 
     306            postact = 'mark'; 
     307          } 
     308          this.http_post(postact, postdata); 
    308309        } 
    309310 
     
    12361237      return url.replace(/(\?.*)$/, urldata); 
    12371238    } 
    1238     else 
    1239       return url + '?' + name + '=' + value; 
     1239 
     1240    return url + '?' + name + '=' + value; 
    12401241  }; 
    12411242 
     
    18921893  this.set_list_options = function(cols, sort_col, sort_order, threads) 
    18931894  { 
    1894     var update, add_url = ''; 
     1895    var update, post_data = {}; 
    18951896 
    18961897    if (sort_col === undefined) 
     
    19061907    if (this.env.threading != threads) { 
    19071908      update = 1; 
    1908       add_url += '&_threads=' + threads; 
     1909      post_data._threads = threads; 
    19091910    } 
    19101911 
     
    19261927      if (newcols.join() != oldcols.join()) { 
    19271928        update = 1; 
    1928         add_url += '&_cols=' + newcols.join(','); 
     1929        post_data._cols = newcols.join(','); 
    19291930      } 
    19301931    } 
    19311932 
    19321933    if (update) 
    1933       this.list_mailbox('', '', sort_col+'_'+sort_order, add_url); 
     1934      this.list_mailbox('', '', sort_col+'_'+sort_order, post_data); 
    19341935  }; 
    19351936 
     
    19711972          } 
    19721973          if (ref.env.preview_pane_mark_read > 0) 
    1973             ref.http_post('mark', '_uid='+id+'&_flag=read&_quiet=1'); 
     1974            ref.http_post('mark', {_uid: id, _flag: 'read', _quiet: 1}); 
    19741975        }, this.env.preview_pane_mark_read * 1000); 
    19751976      } 
     
    20342035 
    20352036  // list messages of a specific mailbox 
    2036   this.list_mailbox = function(mbox, page, sort, add_url) 
    2037   { 
    2038     var url = '', target = window; 
     2037  this.list_mailbox = function(mbox, page, sort, url) 
     2038  { 
     2039    var target = window; 
     2040 
     2041    if (typeof url != 'object') 
     2042      url = {}; 
    20392043 
    20402044    if (!mbox) 
    20412045      mbox = this.env.mailbox ? this.env.mailbox : 'INBOX'; 
    20422046 
    2043     if (add_url) 
    2044       url += add_url; 
    2045  
    20462047    // add sort to url if set 
    20472048    if (sort) 
    2048       url += '&_sort=' + sort; 
     2049      url._sort = sort; 
    20492050 
    20502051    // also send search request to get the right messages 
    20512052    if (this.env.search_request) 
    2052       url += '&_search='+this.env.search_request; 
     2053      url._search = this.env.search_request; 
    20532054 
    20542055    // set page=1 if changeing to another mailbox 
     
    20632064 
    20642065    if (mbox != this.env.mailbox || (mbox == this.env.mailbox && !page && !sort)) 
    2065       url += '&_refresh=1'; 
     2066      url._refresh = 1; 
    20662067 
    20672068    this.select_folder(mbox, '', true); 
     
    20772078    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { 
    20782079      target = window.frames[this.env.contentframe]; 
    2079       url += '&_framed=1'; 
     2080      url._framed = 1; 
    20802081    } 
    20812082 
     
    20832084    if (mbox) { 
    20842085      this.set_busy(true, 'loading'); 
    2085       this.location_href(this.env.comm_path+'&_mbox='+urlencode(mbox)+(page ? '&_page='+page : '')+url, target); 
     2086      url._mbox = mbox; 
     2087      if (page) 
     2088        url._page = page; 
     2089      this.location_href(url, target); 
    20862090    } 
    20872091  }; 
     
    20982102 
    20992103  // send remote request to load message list 
    2100   this.list_mailbox_remote = function(mbox, page, add_url) 
     2104  this.list_mailbox_remote = function(mbox, page, post_data) 
    21012105  { 
    21022106    // clear message list first 
    21032107    this.message_list.clear(); 
    21042108 
    2105     // send request to server 
    2106     var url = '_mbox='+urlencode(mbox)+(page ? '&_page='+page : ''), 
    2107       lock = this.set_busy(true, 'loading'); 
    2108     this.http_request('list', url+add_url, lock); 
     2109    var lock = this.set_busy(true, 'loading'); 
     2110 
     2111    if (typeof post_data != 'object') 
     2112      post_data = {}; 
     2113    post_data._mbox = mbox; 
     2114    if (page) 
     2115      post_data._page = page; 
     2116 
     2117    this.http_request('list', post_data, lock); 
    21092118  }; 
    21102119 
     
    24992508      return; 
    25002509 
    2501     var a_uids = [], 
     2510    var a_uids = [], n, selection, 
    25022511      lock = this.display_message(this.get_label('copyingmessage'), 'loading'), 
    2503       add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''); 
     2512      post_data = {_mbox: this.env.mailbox, _target_mbox: mbox, _from: (this.env.action ? this.env.action : '')}; 
    25042513 
    25052514    if (this.env.uid) 
    25062515      a_uids[0] = this.env.uid; 
    25072516    else { 
    2508       var selection = this.message_list.get_selection(); 
    2509       for (var n in selection) { 
     2517      selection = this.message_list.get_selection(); 
     2518      for (n in selection) { 
    25102519        a_uids.push(selection[n]); 
    25112520      } 
    25122521    } 
    25132522 
    2514     add_url += '&_uid='+this.uids_to_list(a_uids); 
     2523    post_data._uid = this.uids_to_list(a_uids); 
    25152524 
    25162525    // send request to server 
    2517     this.http_post('copy', '_mbox='+urlencode(this.env.mailbox)+add_url, lock); 
     2526    this.http_post('copy', post_data, lock); 
    25182527  }; 
    25192528 
     
    25292538 
    25302539    var lock = false, 
    2531       add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''); 
     2540      add_post = {_target_mbox: mbox, _from: (this.env.action ? this.env.action : '')}; 
    25322541 
    25332542    // show wait message 
    2534     if (this.env.action == 'show') { 
     2543    if (this.env.action == 'show') 
    25352544      lock = this.set_busy(true, 'movingmessage'); 
    2536     } 
    25372545    else 
    25382546      this.show_contentframe(false); 
     
    25412549    this.enable_command(this.env.message_commands, false); 
    25422550 
    2543     this._with_selected_messages('moveto', lock, add_url); 
     2551    this._with_selected_messages('moveto', lock, add_post); 
    25442552  }; 
    25452553 
     
    25962604 
    25972605    this.show_contentframe(false); 
    2598     this._with_selected_messages('delete', false, '&_from='+(this.env.action ? this.env.action : '')); 
     2606    this._with_selected_messages('delete', false, {_from: this.env.action ? this.env.action : ''}); 
    25992607  }; 
    26002608 
    26012609  // Send a specifc moveto/delete request with UIDs of all selected messages 
    26022610  // @private 
    2603   this._with_selected_messages = function(action, lock, add_url) 
    2604   { 
    2605     var a_uids = [], count = 0, msg; 
     2611  this._with_selected_messages = function(action, lock, post_data) 
     2612  { 
     2613    var a_uids = [], count = 0, msg, lock; 
     2614 
     2615    if (typeof(post_data) != 'object') 
     2616      post_data = {}; 
    26062617 
    26072618    if (this.env.uid) 
     
    26352646    // also send search request to get the right messages 
    26362647    if (this.env.search_request) 
    2637       add_url += '&_search='+this.env.search_request; 
     2648      post_data._search = this.env.search_request; 
    26382649 
    26392650    if (this.env.display_next && this.env.next_uid) 
    2640       add_url += '&_next_uid='+this.env.next_uid; 
     2651      post_data._next_uid = this.env.next_uid; 
    26412652 
    26422653    if (count < 0) 
    2643       add_url += '&_count='+(count*-1); 
    2644     else if (count > 0)  
    2645       // remove threads from the end of the list 
     2654      post_data._count = (count*-1); 
     2655    // remove threads from the end of the list 
     2656    else if (count > 0) 
    26462657      this.delete_excessive_thread_rows(); 
    26472658 
    2648     add_url += '&_uid='+this.uids_to_list(a_uids); 
     2659    post_data._uid = this.uids_to_list(a_uids); 
     2660    post_data._mbox = this.env.mailbox; 
    26492661 
    26502662    if (!lock) { 
     
    26542666 
    26552667    // send request to server 
    2656     this.http_post(action, '_mbox='+urlencode(this.env.mailbox)+add_url, lock); 
     2668    this.http_post(action, post_data, lock); 
    26572669  }; 
    26582670 
     
    27132725  { 
    27142726    var i, len = a_uids.length, 
    2715       url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag, 
     2727      post_data = {_uid: this.uids_to_list(a_uids), _flag: flag}, 
    27162728      lock = this.display_message(this.get_label('markingmessage'), 'loading'); 
    27172729 
     
    27222734    // also send search request to get the right messages 
    27232735    if (this.env.search_request) 
    2724       url += '&_search='+this.env.search_request; 
    2725  
    2726     this.http_post('mark', url, lock); 
     2736      post_data._search = this.env.search_request; 
     2737 
     2738    this.http_post('mark', post_data, lock); 
    27272739 
    27282740    for (i=0; i<len; i++) 
     
    27342746  { 
    27352747    var i, len = a_uids.length, 
    2736       url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag, 
     2748      post_data = {_uid: this.uids_to_list(a_uids), _flag: flag}, 
    27372749      lock = this.display_message(this.get_label('markingmessage'), 'loading'); 
    27382750 
     
    27432755    // also send search request to get the right messages 
    27442756    if (this.env.search_request) 
    2745       url += '&_search='+this.env.search_request; 
    2746  
    2747     this.http_post('mark', url, lock); 
     2757      post_data._search = this.env.search_request; 
     2758 
     2759    this.http_post('mark', post_data, lock); 
    27482760  }; 
    27492761 
     
    27832795  { 
    27842796    var i, len=a_uids.length, 
    2785       url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete', 
     2797      post_data = {_uid: this.uids_to_list(a_uids), _flag: 'undelete'}, 
    27862798      lock = this.display_message(this.get_label('markingmessage'), 'loading'); 
    27872799 
     
    27912803    // also send search request to get the right messages 
    27922804    if (this.env.search_request) 
    2793       url += '&_search='+this.env.search_request; 
    2794  
    2795     this.http_post('mark', url, lock); 
     2805      post_data._search = this.env.search_request; 
     2806 
     2807    this.http_post('mark', post_data, lock); 
    27962808    return true; 
    27972809  }; 
     
    27992811  this.flag_as_deleted = function(a_uids) 
    28002812  { 
    2801     var add_url = '', 
    2802       r_uids = [], 
     2813    var r_uids = [], 
     2814      post_data = {_uid: this.uids_to_list(a_uids), _flag: 'delete'}, 
     2815      lock = this.display_message(this.get_label('markingmessage'), 'loading'), 
    28032816      rows = this.message_list ? this.message_list.rows : [], 
    28042817      count = 0; 
     
    28242837        this.message_list.clear_selection(); 
    28252838      if (count < 0) 
    2826         add_url += '&_count='+(count*-1); 
     2839        post_data._count = (count*-1); 
    28272840      else if (count > 0)  
    28282841        // remove threads from the end of the list 
     
    28302843    } 
    28312844 
    2832     add_url = '&_from='+(this.env.action ? this.env.action : ''), 
    2833       lock = this.display_message(this.get_label('markingmessage'), 'loading'); 
     2845    if (this.env.action) 
     2846      post_data._from = this.env.action; 
    28342847 
    28352848    // ?? 
    28362849    if (r_uids.length) 
    2837       add_url += '&_ruid='+this.uids_to_list(r_uids); 
    2838  
    2839     if (this.env.skip_deleted) { 
    2840       if (this.env.display_next && this.env.next_uid) 
    2841         add_url += '&_next_uid='+this.env.next_uid; 
    2842     } 
     2850      post_data._ruid = this.uids_to_list(r_uids); 
     2851 
     2852    if (this.env.skip_deleted && this.env.display_next && this.env.next_uid) 
     2853      post_data._next_uid = this.env.next_uid; 
    28432854 
    28442855    // also send search request to get the right messages 
    28452856    if (this.env.search_request) 
    2846       add_url += '&_search='+this.env.search_request; 
    2847  
    2848     this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url, lock); 
     2857      post_data._search = this.env.search_request; 
     2858 
     2859    this.http_post('mark', post_data, lock); 
    28492860    return true; 
    28502861  }; 
     
    28932904  this.expunge_mailbox = function(mbox) 
    28942905  { 
    2895     var lock, url = '_mbox='+urlencode(mbox); 
     2906    var lock, post_data = {_mbox: mbox}; 
    28962907 
    28972908    // lock interface if it's the active mailbox 
    28982909    if (mbox == this.env.mailbox) { 
    28992910      lock = this.set_busy(true, 'loading'); 
    2900       url += '&_reload=1'; 
     2911      post_data._reload = 1; 
    29012912      if (this.env.search_request) 
    2902         url += '&_search='+this.env.search_request; 
     2913        post_data._search = this.env.search_request; 
    29032914    } 
    29042915 
    29052916    // send request to server 
    2906     this.http_post('expunge', url, lock); 
     2917    this.http_post('expunge', post_data, lock); 
    29072918  }; 
    29082919 
    29092920  this.purge_mailbox = function(mbox) 
    29102921  { 
    2911     var lock = false, 
    2912       url = '_mbox='+urlencode(mbox); 
     2922    var lock, post_data = {_mbox: mbox}; 
    29132923 
    29142924    if (!confirm(this.get_label('purgefolderconfirm'))) 
     
    29182928    if (mbox == this.env.mailbox) { 
    29192929       lock = this.set_busy(true, 'loading'); 
    2920        url += '&_reload=1'; 
     2930       post_data._reload = 1; 
    29212931     } 
    29222932 
    29232933    // send request to server 
    2924     this.http_post('purge', url, lock); 
     2934    this.http_post('purge', post_data, lock); 
    29252935  }; 
    29262936 
     
    30383048            var gid = id.substr(1); 
    30393049            this.group2expand[gid] = { name:this.env.contactdata[id], input:input.get(0) }; 
    3040             this.http_request('group-expand', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(gid), false); 
     3050            this.http_request('group-expand', {_source: this.env.source, _gid: gid}, false); 
    30413051          } 
    30423052        } 
     
    35483558  { 
    35493559    if (value) 
    3550       this.http_post('addcontact', '_address='+value); 
     3560      this.http_post('addcontact', {_address: value}); 
    35513561 
    35523562    return true; 
     
    35573567  { 
    35583568    if (value != '') { 
    3559       var n, lock = this.set_busy(true, 'searching'); 
     3569      var r, lock = this.set_busy(true, 'searching'), 
     3570        url = this.search_params(value); 
    35603571 
    35613572      if (this.message_list) 
     
    35643575        this.list_contacts_clear(); 
    35653576 
     3577      if (this.env.source) 
     3578        url._source = this.env.source; 
     3579      if (this.env.group) 
     3580        url._gid = this.env.group; 
     3581 
    35663582      // reset vars 
    35673583      this.env.current_page = 1; 
    3568       r = this.http_request('search', this.search_params(value) 
    3569         + (this.env.source ? '&_source='+urlencode(this.env.source) : '') 
    3570         + (this.env.group ? '&_gid='+urlencode(this.env.group) : ''), lock); 
     3584 
     3585      r = this.http_request('search', url, lock); 
    35713586 
    35723587      this.env.qsearch = {lock: lock, request: r}; 
     
    35773592  this.search_params = function(search, filter) 
    35783593  { 
    3579     var n, url = [], mods_arr = [], 
     3594    var n, url = {}, mods_arr = [], 
    35803595      mods = this.env.search_mods, 
    35813596      mbox = this.env.mailbox; 
     
    35883603 
    35893604    if (filter) 
    3590       url.push('_filter=' + urlencode(filter)); 
     3605      url._filter = filter; 
    35913606 
    35923607    if (search) { 
    3593       url.push('_q='+urlencode(search)); 
     3608      url._q = search; 
    35943609 
    35953610      if (mods && this.message_list) 
     
    35993614        for (n in mods) 
    36003615          mods_arr.push(n); 
    3601         url.push('_headers='+mods_arr.join(',')); 
     3616        url._headers = mods_arr.join(','); 
    36023617      } 
    36033618    } 
    36043619 
    36053620    if (mbox) 
    3606       url.push('_mbox='+urlencode(mbox)); 
    3607  
    3608     return url.join('&'); 
     3621      url._mbox = mbox; 
     3622 
     3623    return url; 
    36093624  }; 
    36103625 
     
    37343749      insert += this.env.contacts[id].name + this.env.recipients_delimiter; 
    37353750      this.group2expand[this.env.contacts[id].id] = $.extend({ input: this.ksearch_input }, this.env.contacts[id]); 
    3736       this.http_request('mail/group-expand', '_source='+urlencode(this.env.contacts[id].source)+'&_gid='+urlencode(this.env.contacts[id].id), false); 
     3751      this.http_request('mail/group-expand', {_source: this.env.contacts[id].source, _gid: this.env.contacts[id].id}, false); 
    37373752    } 
    37383753    else if (typeof this.env.contacts[id] === 'string') { 
     
    38083823 
    38093824    var i, lock, source, xhr, reqid = new Date().getTime(), 
     3825      post_data = {_search: q, _id: reqid}, 
    38103826      threads = props && props.threads ? props.threads : 1, 
    38113827      sources = props && props.sources ? props.sources : [], 
     
    38203836        break; 
    38213837 
     3838      post_data._source = source ? source : ''; 
    38223839      lock = this.display_message(this.get_label('searching'), 'loading'); 
    3823       xhr = this.http_post(action, '_search='+urlencode(q)+'&_id='+reqid 
    3824         + (source ? '&_source='+urlencode(source) : ''), lock); 
     3840      xhr = this.http_post(action, post_data, lock); 
    38253841 
    38263842      this.ksearch_data.locks.push(lock); 
     
    39003916      data.num--; 
    39013917      if (maxlen > 0 && data.sources.length) { 
    3902         var lock, xhr, source = data.sources.shift(); 
     3918        var lock, xhr, source = data.sources.shift(), post_data; 
    39033919        if (source) { 
     3920          post_data = {_search: value, _id: reqid, _source: source}; 
    39043921          lock = this.display_message(this.get_label('searching'), 'loading'); 
    3905           xhr = this.http_post(data.action, '_search='+urlencode(value)+'&_id='+reqid 
    3906             +'&_source='+urlencode(source), lock); 
     3922          xhr = this.http_post(data.action, post_data, lock); 
    39073923 
    39083924          this.ksearch_data.locks.push(lock); 
     
    40304046  this.list_contacts = function(src, group, page) 
    40314047  { 
    4032     var folder, add_url = '', 
     4048    var folder, url = {}, 
    40334049      target = window; 
    40344050 
     
    40644080    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { 
    40654081      target = window.frames[this.env.contentframe]; 
    4066       add_url = '&_framed=1'; 
     4082      url._framed = 1; 
    40674083    } 
    40684084 
    40694085    if (group) 
    4070       add_url += '&_gid='+group; 
     4086      url._gid = group; 
    40714087    if (page) 
    4072       add_url += '&_page='+page; 
     4088      url._page = page; 
     4089    if (src) 
     4090      url._source = src; 
    40734091 
    40744092    // also send search request to get the correct listing 
    40754093    if (this.env.search_request) 
    4076       add_url += '&_search='+this.env.search_request; 
     4094      url._search = this.env.search_request; 
    40774095 
    40784096    this.set_busy(true, 'loading'); 
    4079     this.location_href(this.env.comm_path + (src ? '&_source='+urlencode(src) : '') + add_url, target); 
     4097    this.location_href(url, target); 
    40804098  }; 
    40814099 
     
    40874105 
    40884106    // send request to server 
    4089     var url = (src ? '_source='+urlencode(src) : '') + (page ? (src?'&':'') + '_page='+page : ''), 
    4090       lock = this.set_busy(true, 'loading'); 
     4107    var url = {}, lock = this.set_busy(true, 'loading'); 
     4108 
     4109    if (src) 
     4110      url._source = src; 
     4111    if (page) 
     4112      url._page = page; 
     4113    if (group) 
     4114      url._gid = group; 
    40914115 
    40924116    this.env.source = src; 
    40934117    this.env.group = group; 
    40944118 
    4095     if (group) 
    4096       url += '&_gid='+group; 
    4097  
    40984119    // also send search request to get the right messages 
    40994120    if (this.env.search_request) 
    4100       url += '&_search='+this.env.search_request; 
     4121      url._search = this.env.search_request; 
    41014122 
    41024123    this.http_request(this.env.task == 'mail' ? 'list-contacts' : 'list', url, lock); 
     
    41144135  this.load_contact = function(cid, action, framed) 
    41154136  { 
    4116     var add_url = '', target = window; 
     4137    var url = {}, target = window; 
    41174138 
    41184139    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { 
    4119       add_url = '&_framed=1'; 
     4140      url._framed = 1; 
    41204141      target = window.frames[this.env.contentframe]; 
    41214142      this.show_contentframe(true); 
     
    41334154    if (action && (cid || action=='add') && !this.drag_active) { 
    41344155      if (this.env.group) 
    4135         add_url += '&_gid='+urlencode(this.env.group); 
    4136  
    4137       this.location_href(this.env.comm_path+'&_action='+action 
    4138         +'&_source='+urlencode(this.env.source) 
    4139         +'&_cid='+urlencode(cid) + add_url, target, true); 
    4140     } 
     4156        url._gid = this.env.group; 
     4157 
     4158      url._action = action; 
     4159      url._source = this.env.source; 
     4160      url._cid = cid; 
     4161 
     4162      this.location_href(url, target, true); 
     4163    } 
     4164 
    41414165    return true; 
    41424166  }; 
     
    41464170  { 
    41474171    what = what == 'add' ? 'add' : 'del'; 
    4148     var lock = this.display_message(this.get_label(what == 'add' ? 'addingmember' : 'removingmember'), 'loading'); 
    4149  
    4150     this.http_post('group-'+what+'members', '_cid='+urlencode(cid) 
    4151       + '&_source='+urlencode(source) 
    4152       + '&_gid='+urlencode(gid), lock); 
     4172    var label = this.get_label(what == 'add' ? 'addingmember' : 'removingmember'), 
     4173      lock = this.display_message(label, 'loading'), 
     4174      post_data = {_cid: cid, _source: source, _gid: gid}; 
     4175 
     4176    this.http_post('group-'+what+'members', post_data, lock); 
    41534177  }; 
    41544178 
     
    41624186      this.group_member_change('add', cid, to.source, to.id); 
    41634187    else if (to.type == 'group' && !this.env.address_sources[to.source].readonly) { 
    4164       var lock = this.display_message(this.get_label('copyingcontact'), 'loading'); 
    4165       this.http_post('copy', '_cid='+urlencode(cid) 
    4166         + '&_source='+urlencode(this.env.source) 
    4167         + '&_to='+urlencode(to.source) 
    4168         + '&_togid='+urlencode(to.id) 
    4169         + (this.env.group ? '&_gid='+urlencode(this.env.group) : ''), lock); 
     4188      var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), 
     4189        post_data = {_cid: cid, _source: this.env.source, _to: to.source, _togid: to.id, 
     4190          _gid: (this.env.group ? this.env.group : '')}; 
     4191 
     4192      this.http_post('copy', post_data, lock); 
    41704193    } 
    41714194    else if (to.id != this.env.source && cid && this.env.address_sources[to.id] && !this.env.address_sources[to.id].readonly) { 
    4172       var lock = this.display_message(this.get_label('copyingcontact'), 'loading'); 
    4173       this.http_post('copy', '_cid='+urlencode(cid) 
    4174         + '&_source='+urlencode(this.env.source) 
    4175         + '&_to='+urlencode(to.id) 
    4176         + (this.env.group ? '&_gid='+urlencode(this.env.group) : ''), lock); 
     4195      var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), 
     4196        post_data = {_cid: cid, _source: this.env.source, _to: to.id, 
     4197          _gid: (this.env.group ? this.env.group : '')}; 
     4198 
     4199      this.http_post('copy', post_data, lock); 
    41774200    } 
    41784201  }; 
     
    41874210      return; 
    41884211 
    4189     var id, n, a_cids = [], qs = ''; 
     4212    var id, n, a_cids = [], 
     4213      post_data = {_source: this.env.source, _from: (this.env.action ? this.env.action : '')}, 
     4214      lock = this.display_message(this.get_label('contactdeleting'), 'loading'); 
    41904215 
    41914216    if (this.env.cid) 
     
    42034228    } 
    42044229 
     4230    post_data._cid = a_cids.join(','); 
     4231 
    42054232    if (this.env.group) 
    4206       qs += '&_gid='+urlencode(this.env.group); 
     4233      post_data._gid = this.env.group; 
    42074234 
    42084235    // also send search request to get the right records from the next page 
    42094236    if (this.env.search_request) 
    4210       qs += '&_search='+this.env.search_request; 
     4237      post_data._search = this.env.search_request; 
    42114238 
    42124239    // send request to server 
    4213     this.http_post('delete', '_cid='+urlencode(a_cids.join(',')) 
    4214       +'&_source='+urlencode(this.env.source) 
    4215       +'&_from='+(this.env.action ? this.env.action : '')+qs, 
    4216       this.display_message(this.get_label('contactdeleting'), 'loading')); 
     4240    this.http_post('delete', post_data, lock) 
    42174241 
    42184242    return true; 
     
    43434367    if (this.env.group && confirm(this.get_label('deletegroupconfirm'))) { 
    43444368      var lock = this.set_busy(true, 'groupdeleting'); 
    4345       this.http_post('group-delete', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group), lock); 
     4369      this.http_post('group-delete', {_source: this.env.source, _gid: this.env.group}, lock); 
    43464370    } 
    43474371  }; 
     
    43834407  this.group_remove_selected = function() 
    43844408  { 
    4385     ref.http_post('group-delmembers','_cid='+urlencode(this.contact_list.selection) 
    4386                   + '&_source='+urlencode(this.env.source) 
    4387                   + '&_gid='+urlencode(this.env.group)); 
     4409    ref.http_post('group-delmembers', {_cid: this.contact_list.selection, 
     4410      _source: this.env.source, _gid: this.env.group}); 
    43884411  }; 
    43894412 
     
    43924415  { 
    43934416    if('undefined' != typeof this.env.group && (this.env.group === props.gid)){ 
    4394       var selection = this.contact_list.get_selection(); 
    4395       for (var n=0; n<selection.length; n++) { 
    4396         id = selection[n]; 
    4397         this.contact_list.remove_row(id, (n == selection.length-1)); 
     4417      var n, selection = this.contact_list.get_selection(); 
     4418      for (n=0; n<selection.length; n++) { 
     4419        id = selection[n]; 
     4420        this.contact_list.remove_row(id, (n == selection.length-1)); 
    43984421      } 
    43994422    } 
    44004423  } 
    4401  
    4402  
    44034424 
    44044425  // handler for keyboard events on the input field 
     
    44164437 
    44174438        if (itype == 'contactsearch') 
    4418           this.http_post('search-create', '_search='+urlencode(this.env.search_request)+'&_name='+urlencode(newname), lock); 
     4439          this.http_post('search-create', {_search: this.env.search_request, _name: newname}, lock); 
    44194440        else if (this.env.group_renaming) 
    4420           this.http_post('group-rename', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group)+'&_name='+urlencode(newname), lock); 
     4441          this.http_post('group-rename', {_source: this.env.source, _gid: this.env.group, _name: newname}, lock); 
    44214442        else 
    4422           this.http_post('group-create', '_source='+urlencode(this.env.source)+'&_name='+urlencode(newname), lock); 
     4443          this.http_post('group-create', {_source: this.env.source, _name: newname}, lock); 
    44234444      } 
    44244445      return false; 
     
    47284749  this.advanced_search = function() 
    47294750  { 
    4730     var add_url = '&_form=1', target = window; 
     4751    var url = {_form: 1, _action: 'search'}, target = window; 
    47314752 
    47324753    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { 
    4733       add_url += '&_framed=1'; 
     4754      url._framed = 1; 
    47344755      target = window.frames[this.env.contentframe]; 
    47354756      this.contact_list.clear_selection(); 
    47364757    } 
    47374758 
    4738     this.location_href(this.env.comm_path+'&_action=search'+add_url, target, true); 
     4759    this.location_href(url, target, true); 
    47394760 
    47404761    return true; 
     
    48094830    if (this.env.search_request) { 
    48104831      var lock = this.set_busy(true, 'savedsearchdeleting'); 
    4811       this.http_post('search-delete', '_sid='+urlencode(this.env.search_id), lock); 
     4832      this.http_post('search-delete', {_sid: this.env.search_id}, lock); 
    48124833    } 
    48134834  }; 
     
    48434864    // reset vars 
    48444865    this.env.current_page = 1; 
    4845     this.http_request('search', '_sid='+urlencode(id), lock); 
     4866    this.http_request('search', {_sid: id}, lock); 
    48464867  }; 
    48474868 
     
    48544875  this.section_select = function(list) 
    48554876  { 
    4856     var id = list.get_single_selection(), add_url = '', target = window; 
     4877    var id = list.get_single_selection(), target = window, 
     4878      url = {_action: 'edit-prefs', _section: id}; 
    48574879 
    48584880    if (id) { 
    48594881      if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { 
    4860         add_url = '&_framed=1'; 
     4882        url._framed = 1; 
    48614883        target = window.frames[this.env.contentframe]; 
    48624884      } 
    4863       this.location_href(this.env.comm_path+'&_action=edit-prefs&_section='+id+add_url, target, true); 
     4885      this.location_href(url, target, true); 
    48644886    } 
    48654887 
     
    48824904      return false; 
    48834905 
    4884     var add_url = '', target = window; 
     4906    var target = window, 
     4907      url = {_action: action, _iid: id}; 
    48854908 
    48864909    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { 
    4887       add_url = '&_framed=1'; 
     4910      url._framed = 1; 
    48884911      target = window.frames[this.env.contentframe]; 
    48894912      document.getElementById(this.env.contentframe).style.visibility = 'inherit'; 
     
    48924915    if (action && (id || action == 'add-identity')) { 
    48934916      this.set_busy(true); 
    4894       this.location_href(this.env.comm_path+'&_action='+action+'&_iid='+id+add_url, target); 
     4917      this.location_href(url, target); 
    48954918    } 
    48964919 
     
    50175040 
    50185041      if (newname != this.env.mailbox) { 
    5019         this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.mailbox)+'&_folder_newname='+urlencode(newname), this.set_busy(true, 'foldermoving')); 
     5042        this.http_post('rename-folder', {_folder_oldname: this.env.mailbox, _folder_newname: newname}, this.set_busy(true, 'foldermoving')); 
    50205043        this.subscription_list.draglayer.hide(); 
    50215044      } 
     
    50395062    if (folder && confirm(this.get_label('deletefolderconfirm'))) { 
    50405063      var lock = this.set_busy(true, 'folderdeleting'); 
    5041       this.http_post('delete-folder', '_mbox='+urlencode(folder), lock); 
     5064      this.http_post('delete-folder', {_mbox: folder}, lock); 
    50425065    } 
    50435066  }; 
     
    52375260    if (folder) { 
    52385261      var lock = this.display_message(this.get_label('foldersubscribing'), 'loading'); 
    5239       this.http_post('subscribe', '_mbox='+urlencode(folder), lock); 
     5262      this.http_post('subscribe', {_mbox: folder}, lock); 
    52405263    } 
    52415264  }; 
     
    52455268    if (folder) { 
    52465269      var lock = this.display_message(this.get_label('folderunsubscribing'), 'loading'); 
    5247       this.http_post('unsubscribe', '_mbox='+urlencode(folder), lock); 
     5270      this.http_post('unsubscribe', {_mbox: folder}, lock); 
    52485271    } 
    52495272  }; 
     
    52745297    } 
    52755298 
    5276     if (String(target.location.href).indexOf(url) >= 0 && !force) { 
     5299    if (String(target.location.href).indexOf(url) >= 0 && !force) 
    52775300      this.show_contentframe(true); 
    5278     } 
    5279     else { 
     5301    else 
    52805302      this.location_href(this.env.comm_path+url, target, true); 
    5281     } 
    52825303  }; 
    52835304 
     
    52935314  { 
    52945315    var lock = this.set_busy(true, 'loading'); 
    5295     this.http_post('folder-size', '_mbox='+urlencode(folder), lock); 
     5316    this.http_post('folder-size', {_mbox: folder}, lock); 
    52965317  }; 
    52975318 
     
    53685389 
    53695390      // get default/passive setting of the button 
    5370       if (obj && button.type=='image' && !button.status) { 
     5391      if (obj && button.type == 'image' && !button.status) { 
    53715392        button.pas = obj._original_src ? obj._original_src : obj.src; 
    53725393        // respect PNG fix on IE browsers 
     
    53785399 
    53795400      // set image according to button state 
    5380       if (obj && button.type=='image' && button[state]) { 
     5401      if (obj && button.type == 'image' && button[state]) { 
    53815402        button.status = state; 
    53825403        obj.src = button[state]; 
     
    58375858    if (!this.gui_objects.all_headers_box.innerHTML) { 
    58385859      var lock = this.display_message(this.get_label('loading'), 'loading'); 
    5839       this.http_post('headers', '_uid='+this.env.uid, lock); 
     5860      this.http_post('headers', {_uid: this.env.uid}, lock); 
    58405861    } 
    58415862  }; 
     
    59015922      query._action = this.env.action; 
    59025923 
    5903     var base = this.env.comm_path; 
     5924    var base = this.env.comm_path, k, param = {}; 
    59045925 
    59055926    // overwrite task name 
     
    59105931 
    59115932    // remove undefined values 
    5912     var param = {}; 
    5913     for (var k in query) { 
     5933    for (k in query) { 
    59145934      if (query[k] !== undefined && query[k] !== null) 
    59155935        param[k] = query[k]; 
     
    59395959    if (frame) 
    59405960      this.lock_frame(); 
     5961 
     5962    if (typeof url == 'object') 
     5963      url = this.env.comm_path + '&' + $.param(url); 
    59415964 
    59425965    // simulate real link click to force IE to send referer header 
     
    62196242      return; 
    62206243 
    6221     var lock, addurl = '_mbox=' + urlencode(this.env.mailbox); 
     6244    var lock, url = {_mbox: this.env.mailbox}; 
    62226245 
    62236246    if (refresh) { 
    62246247      lock = this.set_busy(true, 'checkingmail'); 
    6225       addurl += '&_refresh=1'; 
     6248      url._refresh = 1; 
    62266249      // reset check-recent interval 
    62276250      this.start_keepalive(); 
     
    62296252 
    62306253    if (this.gui_objects.messagelist) 
    6231       addurl += '&_list=1'; 
     6254      url._list = 1; 
    62326255    if (this.gui_objects.quotadisplay) 
    6233       addurl += '&_quota=1'; 
     6256      url._quota = 1; 
    62346257    if (this.env.search_request) 
    6235       addurl += '&_search=' + this.env.search_request; 
    6236  
    6237     this.http_request('check-recent', addurl, lock); 
     6258      url._search = this.env.search_request; 
     6259 
     6260    this.http_request('check-recent', url, lock); 
    62386261  }; 
    62396262 
Note: See TracChangeset for help on using the changeset viewer.