Changeset 1238 in subversion


Ignore:
Timestamp:
Apr 2, 2008 1:27:35 PM (5 years ago)
Author:
alec
Message:

#1484681

Location:
trunk/roundcubemail/program
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_imap.inc

    r1219 r1238  
    16491649   * Subscribe to a specific mailbox(es) 
    16501650   * 
    1651    * @param string Mailbox name(s) 
     1651   * @param array Mailbox name(s) 
    16521652   * @return boolean True on success 
    16531653   */  
    1654   function subscribe($mbox_name) 
    1655     { 
    1656     if (is_array($mbox_name)) 
    1657       $a_mboxes = $mbox_name; 
    1658     else if (is_string($mbox_name) && strlen($mbox_name)) 
    1659       $a_mboxes = explode(',', $mbox_name); 
    1660      
     1654  function subscribe($a_mboxes) 
     1655    { 
     1656    if (!is_array($a_mboxes)) 
     1657      $a_mboxes = array($a_mboxes); 
     1658 
    16611659    // let this common function do the main work 
    16621660    return $this->_change_subscription($a_mboxes, 'subscribe'); 
     
    16671665   * Unsubscribe mailboxes 
    16681666   * 
    1669    * @param string Mailbox name(s) 
     1667   * @param array Mailbox name(s) 
    16701668   * @return boolean True on success 
    16711669   */ 
    1672   function unsubscribe($mbox_name) 
    1673     { 
    1674     if (is_array($mbox_name)) 
    1675       $a_mboxes = $mbox_name; 
    1676     else if (is_string($mbox_name) && strlen($mbox_name)) 
    1677       $a_mboxes = (array)$mbox_name; 
     1670  function unsubscribe($a_mboxes) 
     1671    { 
     1672    if (!is_array($a_mboxes)) 
     1673      $a_mboxes = array($a_mboxes); 
    16781674 
    16791675    // let this common function do the main work 
  • trunk/roundcubemail/program/js/app.js

    r1237 r1238  
    28262826  this.subscribe_folder = function(folder) 
    28272827    { 
    2828     var form; 
    2829     if ((form = this.gui_objects.editform) && form.elements['_unsubscribed']) 
    2830       this.change_subscription('_unsubscribed', '_subscribed', 'subscribe'); 
    2831     else if (folder) 
    2832       this.http_post('subscribe', '_mboxes='+urlencode(folder)); 
     2828    if (folder) 
     2829      this.http_post('subscribe', '_mbox='+urlencode(folder)); 
    28332830    }; 
    28342831 
     
    28362833  this.unsubscribe_folder = function(folder) 
    28372834    { 
    2838     var form; 
    2839     if ((form = this.gui_objects.editform) && form.elements['_subscribed']) 
    2840       this.change_subscription('_subscribed', '_unsubscribed', 'unsubscribe'); 
    2841     else if (folder) 
    2842       this.http_post('unsubscribe', '_mboxes='+urlencode(folder)); 
    2843     }; 
    2844      
    2845  
    2846   this.change_subscription = function(from, to, action) 
    2847     { 
    2848     var form; 
    2849     if (form = this.gui_objects.editform) 
    2850       { 
    2851       var a_folders = new Array(); 
    2852       var list_from = form.elements[from]; 
    2853  
    2854       for (var i=0; list_from && i<list_from.options.length; i++) 
    2855         { 
    2856         if (list_from.options[i] && list_from.options[i].selected) 
    2857           { 
    2858           a_folders[a_folders.length] = list_from.options[i].value; 
    2859           list_from[i] = null; 
    2860           i--; 
    2861           } 
    2862         } 
    2863  
    2864       // yes, we have some folders selected 
    2865       if (a_folders.length) 
    2866         { 
    2867         var list_to = form.elements[to]; 
    2868         var index; 
    2869          
    2870         for (var n=0; n<a_folders.length; n++) 
    2871           { 
    2872           index = list_to.options.length; 
    2873           list_to[index] = new Option(a_folders[n]); 
    2874           } 
    2875            
    2876         this.http_post(action, '_mboxes='+urlencode(a_folders.join(','))); 
    2877         } 
    2878       } 
    2879        
    2880     }; 
     2835    if (folder) 
     2836      this.http_post('unsubscribe', '_mbox='+urlencode(folder)); 
     2837    }; 
     2838     
    28812839 
    28822840  // helper method to find a specific mailbox row ID 
  • trunk/roundcubemail/program/steps/settings/manage_folders.inc

    r1159 r1238  
    2929if ($_action=='subscribe') 
    3030  { 
    31   if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    32     $IMAP->subscribe($mboxes); 
     31  if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)) 
     32    $IMAP->subscribe(array($mbox)); 
    3333 
    3434  if ($OUTPUT->ajax_call) 
     
    3939else if ($_action=='unsubscribe') 
    4040  { 
    41   if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    42     $IMAP->unsubscribe($mboxes); 
     41  if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)) 
     42    $IMAP->unsubscribe(array($mbox)); 
    4343 
    4444  if ($OUTPUT->ajax_call) 
Note: See TracChangeset for help on using the changeset viewer.