Changeset 3492 in subversion


Ignore:
Timestamp:
Apr 15, 2010 7:28:15 AM (3 years ago)
Author:
alec
Message:
  • Fix messages list scrolling in FF3.6 (#1486472)
  • Fix quicksearch input focus (#1486637)
  • Small code cleanup + improvements
Location:
trunk/roundcubemail
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r3489 r3492  
    22=========================== 
    33 
     4- Fix messages list scrolling in FF3.6 (#1486472) 
     5- Fix quicksearch input focus (#1486637) 
    46- Always set changed date when flagging a DB record as deleted + provide a cleanup script 
    57- Fix address book/group selection (#1486619) 
  • trunk/roundcubemail/program/js/app.js

    r3488 r3492  
    5656 
    5757  // set jQuery ajax options 
    58   jQuery.ajaxSetup({ cache:false, 
     58  jQuery.ajaxSetup({ 
     59    cache:false, 
    5960    error:function(request, status, err){ ref.http_error(request, status, err); }, 
    6061    beforeSend:function(xmlhttp){ xmlhttp.setRequestHeader('X-RoundCube-Request', ref.env.request_token); } 
     
    132133     
    133134    // check browser 
    134     if (!bw.dom || !bw.xmlhttp_test()) 
    135       { 
     135    if (!bw.dom || !bw.xmlhttp_test()) { 
    136136      this.goto_url('error', '_code=0x199'); 
    137137      return; 
     
    177177          this.message_list.addEventListener('dragend', function(e){ p.drag_end(e); }); 
    178178          this.message_list.addEventListener('expandcollapse', function(e){ p.msglist_expand(e); }); 
     179 
    179180          document.onmouseup = function(e){ return p.doc_mouse_up(e); }; 
     181          this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; 
    180182 
    181183          this.set_message_coltypes(this.env.coltypes); 
    182184          this.message_list.init(); 
    183185          this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', true); 
    184            
    185           if (this.gui_objects.mailcontframe) 
    186             this.gui_objects.mailcontframe.onmousedown = function(e){ return p.click_on_list(e); }; 
    187           else 
    188             this.message_list.focus(); 
    189186           
    190187          // load messages 
     
    193190          } 
    194191 
    195         if (this.env.search_text != null && document.getElementById('quicksearchbox') != null) 
    196           document.getElementById('quicksearchbox').value = this.env.search_text; 
    197          
    198         if (this.env.action=='show' || this.env.action=='preview') 
    199           { 
     192        if (this.gui_objects.qsearchbox) { 
     193          if (this.env.search_text != null) { 
     194            this.gui_objects.qsearchbox.value = this.env.search_text; 
     195            } 
     196          $(this.gui_objects.qsearchbox).focusin(function() { rcmail.message_list.blur(); }); 
     197          } 
     198 
     199        if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox) 
     200          this.set_alttext('delete', 'movemessagetotrash'); 
     201 
     202        if (this.env.action=='show' || this.env.action=='preview') { 
    200203          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete', 
    201204            'open', 'mark', 'edit', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers', true); 
    202205 
    203           if (this.env.next_uid) 
    204             { 
     206          if (this.env.next_uid) { 
    205207            this.enable_command('nextmessage', true); 
    206208            this.enable_command('lastmessage', true); 
    207209            } 
    208           if (this.env.prev_uid) 
    209             { 
     210          if (this.env.prev_uid) { 
    210211            this.enable_command('previousmessage', true); 
    211212            this.enable_command('firstmessage', true); 
    212213            } 
    213214         
    214           if (this.env.blockedobjects) 
    215             { 
     215          if (this.env.blockedobjects) { 
    216216            if (this.gui_objects.remoteobjectsmsg) 
    217217              this.gui_objects.remoteobjectsmsg.style.display = 'block'; 
    218218            this.enable_command('load-images', 'always-load', true); 
    219219            } 
     220 
     221          // make preview/message frame visible 
     222          if (this.env.action == 'preview' && this.env.framed && parent.rcmail) { 
     223            this.enable_command('compose', 'add-contact', false); 
     224            parent.rcmail.show_contentframe(true); 
     225            } 
    220226          } 
    221  
    222         if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox) 
    223           this.set_alttext('delete', 'movemessagetotrash'); 
    224          
    225         // make preview/message frame visible 
    226         if (this.env.action == 'preview' && this.env.framed && parent.rcmail) 
    227           { 
    228           this.enable_command('compose', 'add-contact', false); 
    229           parent.rcmail.show_contentframe(true); 
    230           } 
    231  
    232         if (this.env.action=='compose') 
    233           { 
     227        else if (this.env.action == 'compose') { 
    234228          this.enable_command('add-attachment', 'send-attachment', 'remove-attachment', 'send', true); 
    235           if (this.env.spellcheck) 
    236             { 
     229 
     230          if (this.env.spellcheck) { 
    237231            this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); }; 
    238232            this.set_spellcheck_state('ready'); 
     
    240234              this.display_spellcheck_controls(false); 
    241235            } 
     236 
    242237          if (this.env.drafts_mailbox) 
    243238            this.enable_command('savedraft', true); 
     
    248243          this.init_messageform(); 
    249244          } 
     245        // show printing dialog 
     246        else if (this.env.action == 'print') 
     247          window.print(); 
    250248 
    251249        if (this.env.messagecount) { 
    252250          this.enable_command('select-all', 'select-none', 'expunge', true); 
    253251          this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading); 
    254         } 
     252          } 
    255253 
    256254        if (this.purge_mailbox_test()) 
     
    259257        this.set_page_buttons(); 
    260258 
    261         // show printing dialog 
    262         if (this.env.action=='print') 
    263           window.print(); 
    264  
    265259        // get unread count for each mailbox 
    266         if (this.gui_objects.mailboxlist) 
    267         { 
     260        if (this.gui_objects.mailboxlist) { 
    268261          this.env.unread_counts = {}; 
    269262          this.gui_objects.folderlist = this.gui_objects.mailboxlist; 
    270263          this.http_request('getunread', ''); 
    271         } 
     264          } 
    272265         
    273266        // ask user to send MDN 
    274         if (this.env.mdn_request && this.env.uid) 
    275         { 
     267        if (this.env.mdn_request && this.env.uid) { 
    276268          var mdnurl = '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox); 
    277269          if (confirm(this.get_label('mdnrequest'))) 
     
    279271          else 
    280272            this.http_post('mark', mdnurl+'&_flag=mdnsent'); 
    281         } 
     273          } 
    282274 
    283275        break; 
     
    303295            this.contact_list.highlight_row(this.env.cid); 
    304296 
    305           if (this.gui_objects.contactslist.parentNode) 
    306             { 
    307             this.gui_objects.contactslist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; 
    308             document.onmouseup = function(e){ return p.doc_mouse_up(e); }; 
     297          this.gui_objects.contactslist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; 
     298          document.onmouseup = function(e){ return p.doc_mouse_up(e); }; 
     299          if (this.gui_objects.qsearchbox) { 
     300            $(this.gui_objects.qsearchbox).focusin(function() { rcmail.contact_list.blur(); }); 
    309301            } 
    310           else 
    311             this.contact_list.focus(); 
    312              
    313           //this.gui_objects.folderlist = this.gui_objects.contactslist; 
    314302          } 
    315303 
     
    406394    // execute all foreign onload scripts 
    407395    // @deprecated 
    408     for (var i=0; i<this.onloads.length; i++) 
    409       { 
     396    for (var i=0; i<this.onloads.length; i++) { 
    410397      if (typeof(this.onloads[i]) == 'string') 
    411398        eval(this.onloads[i]); 
     
    501488      case 'open': 
    502489        var uid; 
    503         if (uid = this.get_single_uid()) 
    504         { 
     490        if (uid = this.get_single_uid()) { 
    505491          obj.href = '?_task='+this.env.task+'&_action=show&_mbox='+urlencode(this.env.mailbox)+'&_uid='+uid; 
    506492          return true; 
     
    510496      // misc list commands 
    511497      case 'list': 
    512         if (this.task=='mail') 
    513           { 
     498        if (this.task=='mail') { 
    514499          if (this.env.search_request<0 || (props != '' && (this.env.search_request && props != this.env.mailbox))) 
    515500            this.reset_qsearch(); 
     
    519504          if (this.env.trash_mailbox) 
    520505            this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage'); 
    521           } 
    522         else if (this.task=='addressbook') 
    523           { 
     506        } 
     507        else if (this.task=='addressbook') { 
    524508          if (this.env.search_request<0 || (this.env.search_request && props != this.env.source)) 
    525509            this.reset_qsearch(); 
     
    527511          this.list_contacts(props); 
    528512          this.enable_command('add', 'import', (this.env.address_sources && !this.env.address_sources[this.env.source].readonly)); 
    529           } 
     513        } 
    530514        break; 
    531515 
     
    586570      // common commands used in multiple tasks 
    587571      case 'show': 
    588         if (this.task=='mail') 
    589           { 
     572        if (this.task=='mail') { 
    590573          var uid = this.get_single_uid(); 
    591           if (uid && (!this.env.uid || uid != this.env.uid)) 
    592             { 
     574          if (uid && (!this.env.uid || uid != this.env.uid)) { 
    593575            if (this.env.mailbox == this.env.drafts_mailbox) 
    594576              this.goto_url('compose', '_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox), true); 
    595577            else 
    596578              this.show_message(uid); 
    597             } 
    598579          } 
    599         else if (this.task=='addressbook') 
    600           { 
     580        } 
     581        else if (this.task=='addressbook') { 
    601582          var cid = props ? props : this.get_single_cid(); 
    602583          if (cid && !(this.env.action=='show' && cid==this.env.cid)) 
    603584            this.load_contact(cid, 'show'); 
    604           } 
     585        } 
    605586        break; 
    606587 
     
    608589        if (this.task=='addressbook') 
    609590          this.load_contact(0, 'add'); 
    610         else if (this.task=='settings') 
    611           { 
     591        else if (this.task=='settings') { 
    612592          this.identity_list.clear_selection(); 
    613593          this.load_identity(0, 'add-identity'); 
    614           } 
     594        } 
    615595        break; 
    616596 
     
    701681        var flag = 'read'; 
    702682         
    703         if (props._row.uid) 
    704           { 
     683        if (props._row.uid) { 
    705684          uid = props._row.uid; 
    706685           
     
    708687          if (this.message_list.rows[uid].deleted) { 
    709688            flag = 'undelete'; 
    710           } else if (!this.message_list.rows[uid].unread) 
     689          } 
     690          else if (!this.message_list.rows[uid].unread) 
    711691            flag = 'unread'; 
    712           } 
     692        } 
    713693           
    714694        this.mark_message(flag, uid); 
     
    722702        var flag = 'flagged'; 
    723703 
    724         if (props._row.uid) 
    725           { 
     704        if (props._row.uid) { 
    726705          uid = props._row.uid; 
    727706          // toggle flagged/unflagged 
     
    748727         
    749728        // open attachment in frame if it's of a supported mimetype 
    750         if (this.env.uid && props.mimetype && jQuery.inArray(props.mimetype, this.mimetypes)>=0) 
    751           { 
     729        if (this.env.uid && props.mimetype && jQuery.inArray(props.mimetype, this.mimetypes)>=0) { 
    752730          if (props.mimetype == 'text/html') 
    753731            qstring += '&_safe=1'; 
    754732          this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'); 
    755           if (this.attachment_win) 
    756             { 
     733          if (this.attachment_win) { 
    757734            window.setTimeout(function(){ ref.attachment_win.focus(); }, 10); 
    758735            break; 
    759             } 
    760736          } 
     737        } 
    761738 
    762739        this.goto_url('get', qstring+'&_download=1', false); 
     
    818795        var url = this.env.comm_path+'&_action=compose'; 
    819796        
    820         if (this.task=='mail') 
    821         { 
     797        if (this.task=='mail') { 
    822798          url += '&_mbox='+urlencode(this.env.mailbox); 
    823799           
    824           if (this.env.mailbox==this.env.drafts_mailbox) 
    825           { 
     800          if (this.env.mailbox==this.env.drafts_mailbox) { 
    826801            var uid; 
    827802            if (uid = this.get_single_uid()) 
     
    832807        } 
    833808        // modify url if we're in addressbook 
    834         else if (this.task=='addressbook') 
    835           { 
     809        else if (this.task=='addressbook') { 
    836810          // switch to mail compose step directly 
    837           if (props && props.indexOf('@') > 0) 
    838             { 
     811          if (props && props.indexOf('@') > 0) { 
    839812            url = this.get_task_url('mail', url); 
    840813            this.redirect(url + '&_to='+urlencode(props)); 
    841814            break; 
    842             } 
     815          } 
    843816           
    844817          // use contact_id passed as command parameter 
     
    847820            a_cids[a_cids.length] = props; 
    848821          // get selected contacts 
    849           else if (this.contact_list) 
    850             { 
     822          else if (this.contact_list) { 
    851823            var selection = this.contact_list.get_selection(); 
    852824            for (var n=0; n<selection.length; n++) 
    853825              a_cids[a_cids.length] = selection[n]; 
    854             } 
     826          } 
    855827             
    856828          if (a_cids.length) 
     
    858830 
    859831          break; 
    860           } 
     832        } 
    861833 
    862834        // don't know if this is necessary... 
    863         url = url.replace(/&_framed=1/, ""); 
     835        url = url.replace(/&_framed=1/, ''); 
    864836 
    865837        this.redirect(url); 
     
    12001172  /*********************************************************/ 
    12011173 
    1202   this.doc_mouse_up = function(e) 
    1203   { 
    1204     var model, list, li; 
    1205  
    1206     if (this.message_list) { 
    1207       if (!rcube_mouse_is_over(e, this.message_list.list)) 
    1208         this.message_list.blur(); 
    1209       list = this.message_list; 
    1210       model = this.env.mailboxes; 
    1211     } 
    1212     else if (this.contact_list) { 
    1213       if (!rcube_mouse_is_over(e, this.contact_list.list)) 
    1214         this.contact_list.blur(); 
    1215       list = this.contact_list; 
    1216       model = this.env.contactfolders; 
    1217     } 
    1218     else if (this.ksearch_value) { 
    1219       this.ksearch_blur(); 
    1220     } 
    1221  
    1222     // handle mouse release when dragging 
    1223     if (this.drag_active && model && this.env.last_folder_target) { 
    1224       var target = model[this.env.last_folder_target]; 
    1225        
    1226       $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); 
    1227       this.env.last_folder_target = null; 
    1228       list.draglayer.hide(); 
    1229  
    1230       if (!this.drag_menu(e, target)) 
    1231         this.command('moveto', target); 
    1232     } 
    1233      
    1234     // reset 'pressed' buttons 
    1235     if (this.buttons_sel) { 
    1236       for (var id in this.buttons_sel) 
    1237         if (typeof id != 'function') 
    1238           this.button_out(this.buttons_sel[id], id); 
    1239       this.buttons_sel = {}; 
    1240     } 
    1241   }; 
    1242  
    12431174  this.drag_menu = function(e, target) 
    12441175  { 
     
    13521283 
    13531284          li = this.get_folder_li(k); 
    1354           div = $(li.getElementsByTagName("div")[0]); 
     1285          div = $(li.getElementsByTagName('div')[0]); 
    13551286 
    13561287          // if the folder is collapsed, expand it after 1sec and restart the drag & drop process. 
     
    13611292            this.folder_auto_expand = k; 
    13621293            this.folder_auto_timer = window.setTimeout(function() { 
    1363                 rcmail.command("collapse-folder", rcmail.folder_auto_expand); 
     1294                rcmail.command('collapse-folder', rcmail.folder_auto_expand); 
    13641295                rcmail.drag_start(null); 
    13651296              }, 1000); 
     
    13831314 
    13841315  this.collapse_folder = function(id) 
    1385     { 
    1386     var div; 
    1387     if ((li = this.get_folder_li(id)) && 
    1388         (div = $(li.getElementsByTagName("div")[0])) && 
    1389         (div.hasClass('collapsed') || div.hasClass('expanded'))) 
    1390       { 
    1391       var ul = $(li.getElementsByTagName("ul")[0]); 
    1392       if (div.hasClass('collapsed')) 
    1393         { 
    1394         ul.show(); 
    1395         div.removeClass('collapsed').addClass('expanded'); 
    1396         var reg = new RegExp('&'+urlencode(id)+'&'); 
    1397         this.set_env('collapsed_folders', this.env.collapsed_folders.replace(reg, '')); 
    1398         } 
     1316  { 
     1317    var li = this.get_folder_li(id); 
     1318    var div = $(li.getElementsByTagName('div')[0]); 
     1319     
     1320    if (!div || (!div.hasClass('collapsed') && !div.hasClass('expanded'))) 
     1321      return; 
     1322     
     1323    var ul = $(li.getElementsByTagName('ul')[0]); 
     1324    if (div.hasClass('collapsed')) { 
     1325      ul.show(); 
     1326      div.removeClass('collapsed').addClass('expanded'); 
     1327      var reg = new RegExp('&'+urlencode(id)+'&'); 
     1328      this.set_env('collapsed_folders', this.env.collapsed_folders.replace(reg, '')); 
     1329    } 
     1330    else { 
     1331      ul.hide(); 
     1332      div.removeClass('expanded').addClass('collapsed'); 
     1333      this.set_env('collapsed_folders', this.env.collapsed_folders+'&'+urlencode(id)+'&'); 
     1334 
     1335      // select parent folder if one of its childs is currently selected 
     1336      if (this.env.mailbox.indexOf(id + this.env.delimiter) == 0) 
     1337        this.command('list', id); 
     1338    } 
     1339 
     1340    // Work around a bug in IE6 and IE7, see #1485309 
     1341    if (bw.ie6 || bw.ie7) { 
     1342      var siblings = li.nextSibling ? li.nextSibling.getElementsByTagName('ul') : null; 
     1343      if (siblings && siblings.length && (li = siblings[0]) && li.style && li.style.display != 'none') { 
     1344        li.style.display = 'none'; 
     1345        li.style.display = ''; 
     1346      } 
     1347    } 
     1348 
     1349    this.http_post('save-pref', '_name=collapsed_folders&_value='+urlencode(this.env.collapsed_folders)); 
     1350    this.set_unread_count_display(id, false); 
     1351  }; 
     1352 
     1353  this.doc_mouse_up = function(e) 
     1354  { 
     1355    var model, list, li; 
     1356 
     1357    if (this.message_list) { 
     1358      if (!rcube_mouse_is_over(e, this.message_list.list.parentNode)) 
     1359        this.message_list.blur(); 
    13991360      else 
    1400         { 
    1401         ul.hide(); 
    1402         div.removeClass('expanded').addClass('collapsed'); 
    1403         this.set_env('collapsed_folders', this.env.collapsed_folders+'&'+urlencode(id)+'&'); 
    1404  
    1405         // select parent folder if one of its childs is currently selected 
    1406         if (this.env.mailbox.indexOf(id + this.env.delimiter) == 0) 
    1407           this.command('list', id); 
    1408         } 
    1409  
    1410       // Work around a bug in IE6 and IE7, see #1485309 
    1411       if ((bw.ie6 || bw.ie7) && 
    1412           li.nextSibling && 
    1413           (li.nextSibling.getElementsByTagName("ul").length>0) && 
    1414           li.nextSibling.getElementsByTagName("ul")[0].style && 
    1415           (li.nextSibling.getElementsByTagName("ul")[0].style.display!='none')) 
    1416         { 
    1417           li.nextSibling.getElementsByTagName("ul")[0].style.display = 'none'; 
    1418           li.nextSibling.getElementsByTagName("ul")[0].style.display = ''; 
    1419         } 
    1420  
    1421       this.http_post('save-pref', '_name=collapsed_folders&_value='+urlencode(this.env.collapsed_folders)); 
    1422       this.set_unread_count_display(id, false); 
    1423       } 
    1424     } 
     1361        this.message_list.focus(); 
     1362      list = this.message_list; 
     1363      model = this.env.mailboxes; 
     1364    } 
     1365    else if (this.contact_list) { 
     1366      if (!rcube_mouse_is_over(e, this.contact_list.list.parentNode)) 
     1367        this.contact_list.blur(); 
     1368      else 
     1369        this.contact_list.focus(); 
     1370      list = this.contact_list; 
     1371      model = this.env.contactfolders; 
     1372    } 
     1373    else if (this.ksearch_value) { 
     1374      this.ksearch_blur(); 
     1375    } 
     1376 
     1377    // handle mouse release when dragging 
     1378    if (this.drag_active && model && this.env.last_folder_target) { 
     1379      var target = model[this.env.last_folder_target]; 
     1380       
     1381      $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); 
     1382      this.env.last_folder_target = null; 
     1383      list.draglayer.hide(); 
     1384 
     1385      if (!this.drag_menu(e, target)) 
     1386        this.command('moveto', target); 
     1387    } 
     1388 
     1389    // reset 'pressed' buttons 
     1390    if (this.buttons_sel) { 
     1391      for (var id in this.buttons_sel) 
     1392        if (typeof id != 'function') 
     1393          this.button_out(this.buttons_sel[id], id); 
     1394      this.buttons_sel = {}; 
     1395    } 
     1396  }; 
    14251397 
    14261398  this.click_on_list = function(e) 
     
    14341406      this.contact_list.focus(); 
    14351407 
    1436     return rcube_event.get_button(e) == 2 ? true : rcube_event.cancel(e); 
     1408    return true; 
    14371409    }; 
    14381410 
  • trunk/roundcubemail/program/js/list.js

    r3487 r3492  
    11601160  } 
    11611161 
     1162  if (this.drag_active) 
     1163    this.focus(); 
    11621164  this.drag_active = false; 
    11631165 
     
    11691171 
    11701172  this.triggerEvent('dragend'); 
    1171      
     1173 
    11721174  return rcube_event.cancel(e); 
    11731175}, 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r3484 r3492  
    176176   
    177177  // set client env 
    178   $OUTPUT->add_gui_object('mailcontframe', 'mailcontframe'); 
    179178  $OUTPUT->add_gui_object('messagelist', $attrib['id']); 
    180179  $OUTPUT->set_env('autoexpand_threads', intval($CONFIG['autoexpand_threads'])); 
Note: See TracChangeset for help on using the changeset viewer.