Changeset 1819 in subversion


Ignore:
Timestamp:
Sep 18, 2008 6:14:16 AM (5 years ago)
Author:
alec
Message:

#1484805: fix next/last page buttons when new message is added to the list + remove last message

Location:
trunk/roundcubemail/program
Files:
3 edited

Legend:

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

    r1813 r1819  
    35603560 
    35613561    this.message_list.insert_row(row, attop); 
     3562 
     3563    // remove 'old' row 
     3564    if (attop && this.env.pagesize && this.message_list.rowcount > this.env.pagesize) 
     3565      { 
     3566        var uid = this.message_list.get_last_row(); 
     3567        this.message_list.remove_row(uid); 
     3568        this.message_list.clear_selection(uid); 
     3569      } 
    35623570    }; 
    35633571 
  • trunk/roundcubemail/program/js/list.js

    r1763 r1819  
    291291 
    292292/** 
    293  * get next and previous rows that are not hidden 
     293 * get next/previous/last rows that are not hidden 
    294294 */ 
    295295get_next_row: function() 
     
    319319}, 
    320320 
    321  
    322 // selects or unselects the proper row depending on the modifier key pressed 
     321get_last_row: function() 
     322{ 
     323  if (this.rowcount) 
     324    { 
     325    var rows = this.list.tBodies[0].rows; 
     326 
     327    for(var i=rows.length-1; i>=0; i--) 
     328      if(rows[i].id && String(rows[i].id).match(/rcmrow([a-z0-9\-_=]+)/i) && this.rows[RegExp.$1] != null) 
     329        return RegExp.$1; 
     330    } 
     331 
     332  return null; 
     333}, 
     334 
     335 
     336/** 
     337 * selects or unselects the proper row depending on the modifier key pressed 
     338 */ 
    323339select_row: function(id, mod_key, with_mouse) 
    324340{ 
     
    483499 
    484500/** 
    485  * Unselect all selected rows 
    486  */ 
    487 clear_selection: function() 
     501 * Unselect selected row(s) 
     502 */ 
     503clear_selection: function(id) 
    488504{ 
    489505  var num_select = this.selection.length; 
    490   for (var n=0; n<this.selection.length; n++) 
    491     if (this.rows[this.selection[n]]) 
    492     { 
    493       this.set_classname(this.rows[this.selection[n]].obj, 'selected', false); 
    494       this.set_classname(this.rows[this.selection[n]].obj, 'unfocused', false); 
    495     } 
    496  
    497   this.selection = new Array(); 
    498    
    499   if (num_select) 
     506 
     507  // one row 
     508  if (id) 
     509    { 
     510    for (var n=0; n<this.selection.length; n++) 
     511      if (this.selection[n] == id) 
     512        { 
     513        this.selection.splice(n,1); 
     514        break; 
     515        } 
     516    } 
     517  // all rows 
     518  else 
     519    { 
     520    for (var n=0; n<this.selection.length; n++) 
     521      if (this.rows[this.selection[n]]) 
     522        { 
     523        this.set_classname(this.rows[this.selection[n]].obj, 'selected', false); 
     524        this.set_classname(this.rows[this.selection[n]].obj, 'unfocused', false); 
     525        } 
     526     
     527    this.selection = new Array(); 
     528    } 
     529 
     530  if (num_select && !this.selection.length) 
    500531    this.trigger_event('select'); 
    501532}, 
  • trunk/roundcubemail/program/steps/mail/check_recent.inc

    r1285 r1819  
    3636 
    3737      $OUTPUT->set_env('messagecount', $IMAP->messagecount()); 
     38      $OUTPUT->set_env('pagesize', $IMAP->page_size); 
     39      $OUTPUT->set_env('pagecount', ceil($IMAP->messagecount()/$IMAP->page_size)); 
    3840      $OUTPUT->command('set_unread_count', $mbox_name, $unread_count, ($mbox_name == 'INBOX')); 
    3941      $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text()); 
Note: See TracChangeset for help on using the changeset viewer.