Changeset 9e55503 in github


Ignore:
Timestamp:
Jul 9, 2010 3:18:06 PM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
c7f7ce8
Parents:
c33e08a
Message:
  • Unified rcmail_ui popups handling
Location:
skins/default
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • skins/default/common.css

    r087c7dc r9e55503  
    534534} 
    535535 
    536 #searchmod 
     536#searchmenulink 
    537537{ 
    538538 position: absolute; 
  • skins/default/functions.js

    rb218aa7 r9e55503  
    2828function rcube_mail_ui() 
    2929{ 
    30   this.popupmenus = { 
    31     markmenu:'markmessagemenu', 
    32     searchmenu:'searchmenu', 
    33     messagemenu:'messagemenu', 
    34     listmenu:'listmenu', 
    35     dragmessagemenu:'dragmessagemenu', 
    36     groupmenu:'groupoptionsmenu', 
    37     mailboxmenu:'mailboxoptionsmenu', 
    38     composemenu:'composeoptionsmenu', 
    39     uploadform:'attachment-form' 
     30  this.popups = { 
     31    markmenu:       {id:'markmessagemenu'}, 
     32    searchmenu:     {id:'searchmenu', editable:1}, 
     33    messagemenu:    {id:'messagemenu'}, 
     34    listmenu:       {id:'listmenu', editable:1}, 
     35    dragmessagemenu:{id:'dragmessagemenu', sticky:1}, 
     36    groupmenu:      {id:'groupoptionsmenu', above:1}, 
     37    mailboxmenu:    {id:'mailboxoptionsmenu', above:1}, 
     38    composemenu:    {id:'composeoptionsmenu', editable:1}, 
     39    uploadmenu:     {id:'attachment-form', editable:1, above:1} 
    4040  }; 
    4141 
    4242  var obj; 
    43   for (var k in this.popupmenus) { 
    44     obj = $('#'+this.popupmenus[k]) 
     43  for (var k in this.popups) { 
     44    obj = $('#'+this.popups[k].id) 
    4545    if (obj.length) 
    46       this[k] = obj; 
     46      this.popups[k].obj = obj; 
     47    else { 
     48      delete this.popups[k]; 
     49    } 
    4750  } 
    4851} 
     
    5053rcube_mail_ui.prototype = { 
    5154 
    52 show_popupmenu: function(obj, refname, show, above) 
    53 { 
     55show_popup: function(popup, show) 
     56{ 
     57  if (typeof this[popup] == 'function') 
     58    return this[popup](show); 
     59  else 
     60    return this.show_popupmenu(popup, show); 
     61}, 
     62 
     63show_popupmenu: function(popup, show) 
     64{ 
     65  var obj = this.popups[popup].obj, 
     66    above = this.popups[popup].above, 
     67    ref = rcube_find_object(popup+'link'); 
     68 
    5469  if (typeof show == 'undefined') 
    5570    show = obj.is(':visible') ? false : true; 
    5671 
    57   var ref = rcube_find_object(refname); 
    5872  if (show && ref) { 
    5973    var pos = $(ref).offset(); 
     
    6680}, 
    6781 
    68 show_markmenu: function(show) 
    69 { 
    70   this.show_popupmenu(this.markmenu, 'markreadbutton', show); 
    71 }, 
    72  
    73 show_messagemenu: function(show) 
    74 { 
    75   this.show_popupmenu(this.messagemenu, 'messagemenulink', show); 
    76 }, 
    77  
    78 show_groupmenu: function(show) 
    79 { 
    80   this.show_popupmenu(this.groupmenu, 'groupactionslink', show, true); 
    81 }, 
    82  
    83 show_mailboxmenu: function(show) 
    84 { 
    85   this.show_popupmenu(this.mailboxmenu, 'mboxactionslink', show, true); 
    86 }, 
    87  
    88 show_composemenu: function(show) 
    89 { 
    90   this.show_popupmenu(this.composemenu, 'composemenulink', show); 
    91 }, 
    92  
    93 show_uploadform: function(show) 
     82dragmessagemenu: function(show) 
     83{ 
     84  this.popups.dragmessagemenu.obj[show?'show':'hide'](); 
     85}, 
     86 
     87uploadmenu: function(show) 
    9488{ 
    9589  if (typeof show == 'object') // called as event handler 
     
    9892    $('#attachment-form input[type=file]').val(''); 
    9993 
    100   this.show_popupmenu(this.uploadform, 'uploadformlink', show, true); 
    101  
    102   if (this.uploadform.is(':visible')) 
     94  this.show_popupmenu('uploadmenu', show); 
     95 
     96  if (this.popups.uploadmenu.obj.is(':visible')) 
    10397    $('#attachment-form input[type=file]').click(); 
    10498}, 
    10599 
    106 show_searchmenu: function(show) 
    107 { 
     100searchmenu: function(show) 
     101{ 
     102  var obj = this.popups.searchmenu.obj, 
     103    ref = rcube_find_object('searchmenulink'); 
     104 
    108105  if (typeof show == 'undefined') 
    109     show = this.searchmenu.is(':visible') ? false : true; 
    110  
    111   var ref = rcube_find_object('searchmod'); 
     106    show = obj.is(':visible') ? false : true; 
     107 
    112108  if (show && ref) { 
    113109    var pos = $(ref).offset(); 
    114     this.searchmenu.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)}); 
    115     this.searchmenu.find(":checked").attr('checked', false); 
     110    obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)}) 
     111        .find(':checked').attr('checked', false); 
    116112 
    117113    if (rcmail.env.search_mods) { 
     
    121117    } 
    122118  } 
    123   this.searchmenu[show?'show':'hide'](); 
     119  obj[show?'show':'hide'](); 
    124120}, 
    125121 
     
    138134}, 
    139135 
    140 show_listmenu: function(show) 
    141 { 
     136listmenu: function(show) 
     137{ 
     138  var obj = this.popups.listmenu.obj, 
     139    ref = rcube_find_object('listmenulink'); 
     140 
    142141  if (typeof show == 'undefined') 
    143     show = this.listmenu.is(':visible') ? false : true; 
    144  
    145   var ref = rcube_find_object('listmenulink'); 
     142    show = obj.is(':visible') ? false : true; 
     143 
    146144  if (show && ref) { 
    147145    var pos = $(ref).offset(), 
    148       menuwidth = this.listmenu.width(), 
     146      menuwidth = obj.width(), 
    149147      pagewidth = $(document).width(); 
    150148 
     
    152150      pos.left = pos.left - menuwidth; 
    153151 
    154     this.listmenu.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)}); 
     152    obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)}); 
    155153    // set form values 
    156154    $('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').attr('checked', 1); 
     
    172170  } 
    173171 
    174   this.listmenu[show?'show':'hide'](); 
     172  obj[show?'show':'hide'](); 
    175173 
    176174  if (show) { 
     
    192190open_listmenu: function(e) 
    193191{ 
    194   this.show_listmenu(); 
     192  this.listmenu(); 
    195193}, 
    196194 
    197195save_listmenu: function() 
    198196{ 
    199   this.show_listmenu(); 
     197  this.listmenu(); 
    200198 
    201199  var sort = $('input[name="sort_col"]:checked').val(), 
     
    210208body_mouseup: function(evt, p) 
    211209{ 
    212   var target = rcube_event.get_target(evt); 
    213  
    214   if (this.markmenu && this.markmenu.is(':visible') && target != rcube_find_object('markreadbutton')) 
    215     this.show_markmenu(false); 
    216   else if (this.messagemenu && this.messagemenu.is(':visible') && target != rcube_find_object('messagemenulink')) 
    217     this.show_messagemenu(false); 
    218   else if (this.dragmessagemenu && this.dragmessagemenu.is(':visible') && !rcube_mouse_is_over(evt, rcube_find_object('dragmessagemenu'))) 
    219     this.dragmessagemenu.hide(); 
    220   else if (this.groupmenu &&  this.groupmenu.is(':visible') && target != rcube_find_object('groupactionslink')) 
    221     this.show_groupmenu(false); 
    222   else if (this.mailboxmenu &&  this.mailboxmenu.is(':visible') && target != rcube_find_object('mboxactionslink')) 
    223     this.show_mailboxmenu(false); 
    224   else if (this.composemenu &&  this.composemenu.is(':visible') && target != rcube_find_object('composemenulink') 
    225     && !this.target_overlaps(target, this.popupmenus.composemenu)) { 
    226     this.show_composemenu(false); 
    227   } 
    228   else if (this.uploadform &&  this.uploadform.is(':visible') && target != rcube_find_object('uploadformlink') 
    229     && !this.target_overlaps(target, this.popupmenus.uploadform)) { 
    230     this.show_uploadform(false); 
    231   } 
    232   else if (this.listmenu && this.listmenu.is(':visible') && target != rcube_find_object('listmenulink') 
    233     && !this.target_overlaps(target, this.popupmenus.listmenu)) { 
    234     this.show_listmenu(false); 
    235   } 
    236   else if (this.searchmenu && this.searchmenu.is(':visible') && target != rcube_find_object('searchmod') 
    237     && !this.target_overlaps(target, this.popupmenus.searchmenu)) { 
    238     this.show_searchmenu(false); 
     210  var i, target = rcube_event.get_target(evt); 
     211 
     212  for (i in this.popups) { 
     213    if (this.popups[i].obj.is(':visible') && target != rcube_find_object(i+'link') 
     214      && (!this.popups[i].editable || !this.target_overlaps(target, this.popups[i].id)) 
     215      && (!this.popups[i].sticky || !rcube_mouse_is_over(evt, rcube_find_object(this.popups[i].id))) 
     216    ) { 
     217      this.show_popup(i, false); 
     218    } 
    239219  } 
    240220}, 
     
    254234{ 
    255235  if (rcube_event.get_keycode(evt) == 27) { 
    256     for (var k in this.popupmenus) { 
    257       if (this[k] && this[k].is(':visible')) 
    258         this[k].hide(); 
     236    for (var k in this.popups) { 
     237      if (this.popups[k].obj.is(':visible')) 
     238        this.show_popup(k, false); 
    259239    } 
    260240  } 
     
    448428    rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui); 
    449429    rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui); 
    450     rcmail.addEventListener('aftersend-attachment', 'show_uploadform', rcmail_ui); 
     430    rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui); 
    451431    rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui); 
    452432    rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); 
  • skins/default/templates/addressbook.html

    r087c7dc r9e55503  
    3030 
    3131<div id="quicksearchbar"> 
    32 <roundcube:button name="searchmod" id="searchmod" image="/images/icons/glass.png" /> 
     32<roundcube:button name="searchmenulink" id="searchmenulink" image="/images/icons/glass.png" /> 
    3333<roundcube:object name="searchform" id="quicksearchbox" /> 
    3434<roundcube:button command="reset-search" id="searchreset" image="/images/icons/reset.gif" title="resetsearch" /> 
     
    4343<div class="boxfooter"> 
    4444  <roundcube:button command="group-create" type="link" title="newcontactgroup" class="buttonPas addgroup" classAct="button addgroup" content=" " /> 
    45   <roundcube:button name="groupactions" id="groupactionslink" type="link" title="groupactions" class="button groupactions" onclick="rcmail_ui.show_groupmenu();return false" content=" " /> 
     45  <roundcube:button name="groupmenulink" id="groupmenulink" type="link" title="groupactions" class="button groupactions" onclick="rcmail_ui.show_popup('groupmenu');return false" content=" " /> 
    4646</div> 
    4747</div> 
  • skins/default/templates/compose.html

    rc33e08a r9e55503  
    2525    <roundcube:button command="send" type="link" class="buttonPas send" classAct="button send" classSel="button sendSel" title="sendmessage" content=" " /> 
    2626    <roundcube:button command="spellcheck" type="link" class="buttonPas spellcheck" classAct="button spellcheck" classSel="button spellcheckSel" title="checkspelling" content=" " /> 
    27     <roundcube:button name="addattachment" type="link" class="button attach" classAct="button attach" classSel="button attachSel" title="addattachment" onclick="rcmail_ui.show_uploadform();return false" content=" " /> 
     27    <roundcube:button name="addattachment" type="link" class="button attach" classAct="button attach" classSel="button attachSel" title="addattachment" onclick="rcmail_ui.show_popup('uploadmenu', true);return false" content=" " /> 
    2828    <roundcube:button command="insert-sig" type="link" class="buttonPas insertsig" classAct="button insertsig" classSel="button insertsigSel" title="insertsignature" content=" " /> 
    2929    <roundcube:button command="savedraft" type="link" class="buttonPas savedraft" classAct="button savedraft" classSel="button savedraftSel" title="savemessage" content=" " /> 
    3030    <roundcube:container name="toolbar" id="compose-toolbar" /> 
    31     <roundcube:button name="messageoptions" id="composemenulink" type="link" class="button messagemenu" title="messageoptions" onclick="rcmail_ui.show_composemenu();return false" content=" " /> 
     31    <roundcube:button name="messageoptions" id="composemenulink" type="link" class="button messagemenu" title="messageoptions" onclick="rcmail_ui.show_popup('composemenu', true);return false" content=" " /> 
    3232</div> 
    3333 
     
    4040</div> 
    4141<div class="boxfooter"> 
    42   <roundcube:button name="uploadform" id="uploadformlink" type="link" title="addattachment" class="button addgroup" onclick="rcmail_ui.show_uploadform();return false" content=" " /> 
     42  <roundcube:button name="uploadmenulink" id="uploadmenulink" type="link" title="addattachment" class="button addgroup" onclick="rcmail_ui.show_popup('uploadmenu', true);return false" content=" " /> 
    4343</div> 
    4444</div> 
  • skins/default/templates/mail.html

    r087c7dc r9e55503  
    3232</div> 
    3333<div class="boxfooter"> 
    34   <!--<roundcube:button name="togglequota" type="link" title="showquota" class="buttonPas showinfo" classAct="button showinfo" onclick="rcmail_ui.toggle_quotadisplay();return false" content=" " />--> 
    35   <roundcube:button name="mboxactions" id="mboxactionslink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_mailboxmenu();return false" content=" " /> 
     34  <roundcube:button name="mailboxmenulink" id="mailboxmenulink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_popup('mailboxmenu');return false" content=" " /> 
    3635 
    3736<roundcube:if condition="env:quota" /> 
     
    126125<roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletemessage" content=" " /> 
    127126<roundcube:container name="toolbar" id="messagetoolbar" /> 
    128 <roundcube:button name="markreadbutton" id="markreadbutton" type="link" class="button markmessage" title="markmessages" onclick="rcmail_ui.show_markmenu();return false" content=" " /> 
    129 <roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_messagemenu();return false" content=" " /> 
     127<roundcube:button name="markmenulink" id="markmenulink" type="link" class="button markmessage" title="markmessages" onclick="rcmail_ui.show_popup('markmenu');return false" content=" " /> 
     128<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " /> 
    130129</div> 
    131130 
     
    158157  <roundcube:object name="searchfilter" class="searchfilter" /> 
    159158</div> 
    160 <roundcube:button name="searchmod" id="searchmod" image="/images/icons/glass_roll.png" onclick="rcmail_ui.show_searchmenu();return false" title="searchmod" /> 
     159<roundcube:button name="searchmenulink" id="searchmenulink" image="/images/icons/glass_roll.png" onclick="rcmail_ui.show_popup('searchmenu');return false" title="searchmod" /> 
    161160<roundcube:object name="searchform" id="quicksearchbox" /> 
    162161<roundcube:button command="reset-search" id="searchreset" image="/images/icons/reset.gif" title="resetsearch" /> 
  • skins/default/templates/message.html

    r087c7dc r9e55503  
    2626<roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletemessage" content=" " /> 
    2727<roundcube:container name="toolbar" id="messagetoolbar" /> 
    28 <roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_messagemenu();return false" content=" " /> 
     28<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " /> 
    2929<roundcube:object name="mailboxlist" type="select" noSelection="moveto" maxlength="25" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" /> 
    3030</div> 
     
    4040</div> 
    4141<div class="boxfooter"> 
    42   <roundcube:button name="mboxactions" id="mboxactionslink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_mailboxmenu();return false" content=" " /> 
     42  <roundcube:button name="mailboxmenulink" id="mailboxmenulink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_popup('mailboxmenu');return false" content=" " /> 
    4343</div> 
    4444</div> 
  • skins/default/templates/messageerror.html

    r087c7dc r9e55503  
    4646</div> 
    4747<div class="boxfooter"> 
    48   <roundcube:button name="mboxactions" id="mboxactionslink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_mailboxmenu();return false" content=" " /> 
     48  <roundcube:button name="mailboxmenulink" id="mailboxmenulink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_popup('mailboxmenu');return false" content=" " /> 
    4949</div> 
    5050</div> 
Note: See TracChangeset for help on using the changeset viewer.