Changeset 3419 in subversion


Ignore:
Timestamp:
Mar 25, 2010 12:29:02 PM (3 years ago)
Author:
alec
Message:
  • Added possibility to select all messages in a folder (#1484756)
Location:
trunk/roundcubemail
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r3415 r3419  
    22=========================== 
    33 
     4- Added possibility to select all messages in a folder (#1484756) 
    45- Added 'imap_force_caps' option for after-login CAPABILITY checking (#1485750) 
    56- Password: Support dovecotpw encryption 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r3413 r3419  
    21162116 
    21172117    $flag = strtoupper($flag); 
    2118     list($uids, $all_mode) = $this->_parse_uids($uids); 
     2118    list($uids, $all_mode) = $this->_parse_uids($uids, $mailbox); 
    21192119 
    21202120    if (strpos($flag, 'UN') === 0) 
     
    22102210    $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
    22112211 
    2212     list($uids, $all_mode) = $this->_parse_uids($uids); 
     2212    list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox); 
    22132213 
    22142214    // exit if no message uids are specified 
     
    22922292    $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
    22932293 
    2294     list($uids, $all_mode) = $this->_parse_uids($uids); 
     2294    list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox); 
    22952295 
    22962296    // exit if no message uids are specified 
     
    23302330    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    23312331 
    2332     list($uids, $all_mode) = $this->_parse_uids($uids); 
     2332    list($uids, $all_mode) = $this->_parse_uids($uids, $mailbox); 
    23332333 
    23342334    // exit if no message uids are specified 
     
    24512451   * 
    24522452   * @param mixed  UIDs array or comma-separated list or '*' or '1:*' 
     2453   * @param string Mailbox name 
    24532454   * @return array Two elements array with UIDs converted to list and ALL flag  
    24542455   * @access private 
    24552456   */ 
    2456   private function _parse_uids($uids) 
     2457  private function _parse_uids($uids, $mailbox) 
    24572458    { 
    24582459    if ($uids === '*' || $uids === '1:*') { 
    2459       $uids = '1:*'; 
    2460       $all = true; 
     2460      if (empty($this->search_set)) { 
     2461        $uids = '1:*'; 
     2462        $all = true; 
     2463        } 
     2464      // get UIDs from current search set 
     2465      // @TODO: skip iil_C_FetchUIDs() and work with IDs instead of UIDs (?) 
     2466      else { 
     2467        if ($this->search_threads) 
     2468          $uids = iil_C_FetchUIDs($this->conn, $mailbox, array_keys($this->search_set['depth'])); 
     2469        else 
     2470          $uids = iil_C_FetchUIDs($this->conn, $mailbox, $this->search_set); 
     2471       
     2472        // save ID-to-UID mapping in local cache 
     2473        if (is_array($uids)) 
     2474          foreach ($uids as $id => $uid) 
     2475            $this->uid_id_map[$mailbox][$uid] = $id; 
     2476 
     2477        $uids = join(',', $uids); 
     2478        } 
    24612479      } 
    24622480    else { 
  • trunk/roundcubemail/program/js/app.js

    r3411 r3419  
    490490      case 'menu-open': 
    491491      case 'menu-save': 
    492         this.triggerEvent(command, {props:props}); 
    493         return false; 
     492            this.triggerEvent(command, {props:props}); 
     493            return false; 
    494494        break; 
    495495 
     
    754754         
    755755      case 'select-all': 
     756        this.select_all_mode = props ? false : true; 
    756757        if (props == 'invert') 
    757758          this.message_list.invert_selection(); 
    758759        else 
    759           this.message_list.select_all(props); 
     760          this.message_list.select_all(props == 'page' ? '' : props); 
    760761        break; 
    761762 
     
    18341835    // unselect selected messages 
    18351836    this.last_selected = 0; 
    1836     if (this.message_list) 
     1837    if (this.message_list) { 
    18371838      this.message_list.clear_selection(); 
    1838      
     1839      this.select_all_mode = false; 
     1840    } 
    18391841    this.select_folder(mbox, this.env.mailbox); 
    18401842    this.env.mailbox = mbox; 
     
    22552257  this._with_selected_messages = function(action, lock, add_url) 
    22562258  { 
    2257     var a_uids = new Array(); 
    2258     var count = 0; 
     2259    var a_uids = new Array(), 
     2260      count = 0; 
    22592261 
    22602262    if (this.env.uid) 
     
    22882290      this.delete_excessive_thread_rows(); 
    22892291 
     2292    add_url += '&_uid='+this.uids_to_list(a_uids); 
     2293 
    22902294    // send request to server 
    2291     this.http_post(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); 
     2295    this.http_post(action, '_mbox='+urlencode(this.env.mailbox)+add_url, lock); 
    22922296  }; 
    22932297 
     
    23562360      this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false)); 
    23572361 
    2358     this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); 
     2362    this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag); 
    23592363 
    23602364    for (var i=0; i<a_uids.length; i++) 
     
    23692373      this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false)); 
    23702374 
    2371     this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); 
     2375    this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag); 
    23722376  }; 
    23732377   
     
    24132417      this.set_message(a_uids[i], 'deleted', false); 
    24142418 
    2415     this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=undelete'); 
     2419    this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete'); 
    24162420    return true; 
    24172421  }; 
     
    24192423  this.flag_as_deleted = function(a_uids) 
    24202424  { 
    2421     var add_url = ''; 
    2422     var r_uids = new Array(); 
    2423     var rows = this.message_list ? this.message_list.rows : new Array(); 
    2424     var count = 0; 
    2425  
    2426     for (var i=0; i<a_uids.length; i++) 
    2427       { 
     2425    var add_url = '', 
     2426      r_uids = new Array(), 
     2427      rows = this.message_list ? this.message_list.rows : new Array(), 
     2428      count = 0; 
     2429 
     2430    for (var i=0; i<a_uids.length; i++) { 
    24282431      uid = a_uids[i]; 
    2429       if (rows[uid]) 
    2430         { 
     2432      if (rows[uid]) { 
    24312433        if (rows[uid].unread) 
    24322434          r_uids[r_uids.length] = uid; 
    24332435 
    2434         if (this.env.skip_deleted) { 
    2435           count += this.update_thread(uid); 
     2436            if (this.env.skip_deleted) { 
     2437              count += this.update_thread(uid); 
    24362438          this.message_list.remove_row(uid, (this.env.display_next && i == this.message_list.selection.length-1)); 
    2437           } 
    2438         else 
    2439           this.set_message(uid, 'deleted', true); 
    2440         } 
    2441       } 
     2439            } 
     2440            else 
     2441              this.set_message(uid, 'deleted', true); 
     2442      } 
     2443    } 
    24422444 
    24432445    // make sure there are no selected rows 
    24442446    if (this.env.skip_deleted && this.message_list) { 
    24452447      if(!this.env.display_next) 
    2446       this.message_list.clear_selection(); 
     2448        this.message_list.clear_selection(); 
    24472449      if (count < 0) 
    24482450        add_url += '&_count='+(count*-1); 
     
    24502452        // remove threads from the end of the list 
    24512453        this.delete_excessive_thread_rows(); 
    2452       } 
     2454    } 
    24532455 
    24542456    add_url = '&_from='+(this.env.action ? this.env.action : ''); 
    24552457     
     2458    // ?? 
    24562459    if (r_uids.length) 
    2457       add_url += '&_ruid='+r_uids.join(','); 
     2460      add_url += '&_ruid='+this.uids_to_list(r_uids); 
    24582461 
    24592462    if (this.env.skip_deleted) { 
     
    24652468    } 
    24662469     
    2467     this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=delete'+add_url); 
     2470    this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url); 
    24682471    return true;   
    24692472  }; 
     
    24732476  this.flag_deleted_as_read = function(uids) 
    24742477  { 
    2475     var icn_src; 
    2476     var rows = this.message_list ? this.message_list.rows : new Array(); 
    2477     var str = String(uids); 
    2478     var a_uids = new Array(); 
    2479  
    2480     a_uids = str.split(','); 
    2481  
    2482     for (var uid, i=0; i<a_uids.length; i++) 
    2483       { 
     2478    var icn_src, uid, 
     2479      rows = this.message_list ? this.message_list.rows : new Array(), 
     2480      str = String(uids), 
     2481      a_uids = str.split(','); 
     2482 
     2483    for (var i=0; i<a_uids.length; i++) { 
    24842484      uid = a_uids[i]; 
    24852485      if (rows[uid]) 
     
    24882488  }; 
    24892489 
     2490  // Converts array of message UIDs to comma-separated list for use in URL 
     2491  // with select_all mode checking 
     2492  this.uids_to_list = function(uids) 
     2493  { 
     2494    return this.select_all_mode ? '*' : uids.join(','); 
     2495  }; 
     2496   
    24902497 
    24912498  /*********************************************************/ 
  • trunk/roundcubemail/program/lib/imap.inc

    r3416 r3419  
    10671067} 
    10681068 
    1069 function iil_C_FetchUIDs(&$conn,$mailbox) { 
     1069function iil_C_FetchUIDs(&$conn, $mailbox, $message_set=null) { 
    10701070        global $clock; 
    1071          
    1072         $num = iil_C_CountMessages($conn, $mailbox); 
    1073         if ($num == 0) { 
    1074             return array(); 
    1075         } 
    1076         $message_set = '1' . ($num>1?':' . $num:''); 
    1077          
    1078         return iil_C_FetchHeaderIndex($conn, $mailbox, $message_set, 'UID'); 
     1071 
     1072        if (is_array($message_set)) 
     1073                $message_set = join(',', $message_set); 
     1074    else if (empty($message_set)) 
     1075                $message_set = '1:*'; 
     1076         
     1077        return iil_C_FetchHeaderIndex($conn, $mailbox, $message_set, 'UID', false); 
    10791078} 
    10801079 
  • trunk/roundcubemail/program/localization/en_US/labels.inc

    r3385 r3419  
    147147$labels['all'] = 'All'; 
    148148$labels['none'] = 'None'; 
     149$labels['currpage'] = 'Current page'; 
    149150$labels['unread'] = 'Unread'; 
    150151$labels['flagged'] = 'Flagged'; 
  • trunk/roundcubemail/program/localization/pl_PL/labels.inc

    r3385 r3419  
    143143$labels['select'] = 'Zaznacz'; 
    144144$labels['all'] = 'Wszystkie'; 
     145$labels['currpage'] = 'BieŌĠ
     146ca strona'; 
    145147$labels['none'] = 'Brak'; 
    146148$labels['unread'] = 'Nieprzeczytane'; 
  • trunk/roundcubemail/program/steps/mail/mark.inc

    r3367 r3419  
    5353  } 
    5454 
    55   if($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) { 
    56     $uids = get_input_value('_ruid', RCUBE_INPUT_POST); 
    57     $read = $IMAP->set_flag($uids, 'SEEN'); 
     55  if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) { 
     56    $ruids = get_input_value('_ruid', RCUBE_INPUT_POST); 
     57    $read = $IMAP->set_flag($ruids, 'SEEN'); 
    5858     
    5959    if ($read != -1 && !$CONFIG['skip_deleted']) 
    60       $OUTPUT->command('flag_deleted_as_read', $uids); 
     60      $OUTPUT->command('flag_deleted_as_read', $ruids); 
    6161  } 
    62      
     62 
    6363  if ($flag == 'SEEN' || $flag == 'UNSEEN' || ($flag == 'DELETED' && !$CONFIG['skip_deleted'])) { 
    6464    rcmail_send_unread_count($IMAP->get_mailbox_name()); 
     
    100100      if ($old_unseen != $unseen_count) { 
    101101        $OUTPUT->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX')); 
    102         $_SESSION['unseen_count'][$mbox] = $unseen_count; 
     102            $_SESSION['unseen_count'][$mbox] = $unseen_count; 
    103103      } 
    104104      $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count)); 
    105105 
    106106      if ($IMAP->threading) 
    107         $count = get_input_value('_count', RCUBE_INPUT_POST); 
     107            $count = get_input_value('_count', RCUBE_INPUT_POST); 
    108108 
    109109      // add new rows from next page (if any) 
    110       if ($count && ($jump_back || $nextpage_count > 0)) { 
     110      if ($count && $uids != '*' && ($jump_back || $nextpage_count > 0)) { 
    111111        $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col']; 
    112112        $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; 
    113113   
    114114        $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order, 
    115           $jump_back ? NULL : $count); 
     115            $jump_back ? NULL : $count); 
    116116       
    117117        rcmail_js_message_list($a_headers, false, false); 
  • trunk/roundcubemail/program/steps/mail/move_del.inc

    r3367 r3419  
    3535 
    3636    $moved = $IMAP->move_message($uids, $target, $mbox); 
    37    
     37 
    3838    if (!$moved) { 
    3939        // send error message 
    40         if ($_POST['_from'] != 'show') 
    41           $OUTPUT->command('list_mailbox'); 
     40            if ($_POST['_from'] != 'show') 
     41            $OUTPUT->command('list_mailbox'); 
    4242        $OUTPUT->show_message('errormoving', 'error'); 
    4343        $OUTPUT->send(); 
     
    5656    if (!$del) { 
    5757        // send error message 
    58         if ($_POST['_from'] != 'show') 
    59           $OUTPUT->command('list_mailbox'); 
     58            if ($_POST['_from'] != 'show') 
     59            $OUTPUT->command('list_mailbox'); 
    6060        $OUTPUT->show_message('errordeleting', 'error'); 
    6161        $OUTPUT->send(); 
     
    122122 
    123123  // add new rows from next page (if any) 
    124   if ($addrows && $count && ($jump_back || $nextpage_count > 0)) { 
     124  if ($addrows && $count && $uids != '*' && ($jump_back || $nextpage_count > 0)) { 
    125125    $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col']; 
    126126    $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; 
  • trunk/roundcubemail/skins/default/mail.css

    r3405 r3419  
    580580} 
    581581 
     582#listcontrols a.page { 
     583  background-position: -135px 0; 
     584} 
     585 
     586#listcontrols a.pagesel { 
     587  background-position: -135px -15px; 
     588} 
     589 
    582590#listcontrols a.unread { 
    583591  background-position: -45px 0; 
  • trunk/roundcubemail/skins/default/templates/mail.html

    r3392 r3419  
    8282      <span><roundcube:label name="select" />:&nbsp;</span> 
    8383      <roundcube:button command="select-all" type="link" title="all" class="buttonPas all" classAct="button all" classSel="button allsel" content=" " /> 
     84      <roundcube:button command="select-all" type="link" prop="page" title="currpage" class="buttonPas page" classAct="button page" classSel="button pagesel" content=" " /> 
    8485      <roundcube:button command="select-all" type="link" prop="unread" title="unread" class="buttonPas unread" classAct="button unread" classSel="button unreadsel" content=" " /> 
    8586      <roundcube:button command="select-all" type="link" prop="invert" title="invert" class="buttonPas invert" classAct="button invert" classSel="button invertsel" content=" " /> 
Note: See TracChangeset for help on using the changeset viewer.