Changeset 5619 in subversion


Ignore:
Timestamp:
Dec 15, 2011 3:32:46 PM (17 months ago)
Author:
thomasb
Message:

Give resizeable splitters to Larry

Location:
trunk/roundcubemail/skins/larry
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/skins/larry/mail.css

    r5617 r5619  
    2424        position: absolute; 
    2525        top: 0; 
    26         left: 250px; 
     26        left: 252px; 
    2727        right: 0; 
    2828        bottom: 0; 
     
    4343        width: 100%; 
    4444        height: 26px; 
     45} 
     46 
     47#mailviewsplitter { 
     48        right: 30px; 
     49        width: 30px; 
     50        left: auto !important; 
    4551} 
    4652 
  • trunk/roundcubemail/skins/larry/settings.css

    r5617 r5619  
    2121} 
    2222 
     23#settings-right { 
     24        position: absolute; 
     25        top: 0; 
     26        left: 232px; 
     27        right: 0; 
     28        bottom: 0; 
     29} 
     30 
    2331#sectionslist { 
    2432        position: absolute; 
    2533        top: 0; 
    26         left: 230px; 
     34        left: 0; 
    2735        width: 260px; 
    2836        bottom: 0; 
     
    3240        position: absolute; 
    3341        top: 0; 
    34         left: 500px; 
     42        left: 270px; 
    3543        right: 0; 
    3644        bottom: 0; 
     
    150158        position: absolute; 
    151159        top: 0; 
    152         left: 230px; 
     160        left: 0; 
    153161        width: 300px; 
    154162        bottom: 0; 
     
    159167        position: absolute; 
    160168        top: 0; 
    161         left: 540px; 
     169        left: 310px; 
    162170        right: 0; 
    163171        bottom: 0; 
  • trunk/roundcubemail/skins/larry/styles.css

    r5617 r5619  
    270270        text-indent: -1000px; 
    271271        background: url(images/buttons.png) -1000px 0 no-repeat; 
     272} 
     273 
     274a.iconbutton.disabled { 
     275        opacity: 0.4; 
     276        cursor: default; 
    272277} 
    273278 
     
    541546        text-shadow: 1px 1px 1px #fff; 
    542547        border-bottom: 1px solid #bbd3da; 
     548        white-space: nowrap; 
    543549} 
    544550 
     
    10411047} 
    10421048 
     1049.splitter { 
     1050        user-select: none; 
     1051        -moz-user-select: none; 
     1052        -khtml-user-select: none; 
     1053        position: absolute; 
     1054        background: url(images/splitter.png) center no-repeat; 
     1055} 
     1056 
     1057.splitter-h { 
     1058        height: 10px; 
     1059        width: 100%; 
     1060        cursor: n-resize; 
     1061        cursor: row-resize; 
     1062        background-position: center 0; 
     1063} 
     1064 
     1065.splitter-v { 
     1066        width: 10px; 
     1067        height: 100%; 
     1068        cursor: e-resize; 
     1069        cursor: col-resize; 
     1070        background-position: 0 center; 
     1071} 
    10431072 
    10441073#rcmdraglayer { 
  • trunk/roundcubemail/skins/larry/templates/folders.html

    r5617 r5619  
    1212 
    1313<roundcube:include file="/includes/settingstabs.html" /> 
     14 
     15<div id="settings-right"> 
    1416 
    1517<div id="folderslist" class="uibox listbox"> 
     
    3032</div> 
    3133 
     34</div> 
     35 
    3236<div id="mailboxmenu" class="popupmenu"> 
    3337        <ul class="toolbarmenu" id="mailboxoptionsmenu"> 
  • trunk/roundcubemail/skins/larry/templates/identities.html

    r5605 r5619  
    1313<roundcube:include file="/includes/settingstabs.html" /> 
    1414 
     15<div id="settings-right"> 
     16         
    1517<div id="identitieslist" class="uibox listbox"> 
    1618<h2 class="boxtitle"><roundcube:label name="identities" /></h2> 
     
    2931</div> 
    3032 
     33</div> 
     34 
    3135<roundcube:include file="/includes/footer.html" /> 
    3236 
  • trunk/roundcubemail/skins/larry/templates/identityedit.html

    r5617 r5619  
    1212 
    1313<roundcube:include file="/includes/settingstabs.html" /> 
     14 
     15<div id="settings-right"> 
    1416 
    1517<div id="identitieslist" class="uibox listbox"> 
     
    4042</div> 
    4143 
     44</div> 
     45 
    4246<roundcube:include file="/includes/footer.html" /> 
    4347 
  • trunk/roundcubemail/skins/larry/templates/mail.html

    r5617 r5619  
    6565<div id="messagelistfooter"> 
    6666        <div id="listcontrols"> 
    67                 <a href="#list" class="iconbutton listmode" id="maillistmode" title="<roundcube:label name='list' />">List</a> 
    68                 <a href="#threads" class="iconbutton threadmode" id="mailthreadmode" title="<roundcube:label name='threads' />">Threads</a> 
     67                <roundcube:if condition="env:threads" /> 
     68                        <a href="#list" class="iconbutton listmode" id="maillistmode" title="<roundcube:label name='list' />">List</a> 
     69                        <a href="#threads" class="iconbutton threadmode" id="mailthreadmode" title="<roundcube:label name='threads' />">Threads</a> 
     70                <roundcube:else /> 
     71                        <a href="#list" class="iconbutton listmode selected" title="<roundcube:label name='list' />" onclick="return false">List</a> 
     72                        <a href="#threads" class="iconbutton threadmode disabled" title="<roundcube:label name='threads' />" onclick="return false">Threads</a> 
     73                <roundcube:endif /> 
    6974        </div> 
    7075 
  • trunk/roundcubemail/skins/larry/templates/settings.html

    r5595 r5619  
    1313<roundcube:include file="/includes/settingstabs.html" /> 
    1414 
     15<div id="settings-right"> 
     16 
    1517<div id="sectionslist" class="uibox listbox"> 
    1618<div class="scroller"> 
     
    2628</div> 
    2729 
     30</div> 
     31 
    2832<roundcube:include file="/includes/footer.html" /> 
    2933 
  • trunk/roundcubemail/skins/larry/ui.js

    r5617 r5619  
    2121 
    2222  var me = this; 
     23  var mailviewsplit; 
    2324 
    2425  // export public methods 
     
    3334  { 
    3435    if (rcmail.env.task == 'mail') { 
     36      rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); 
    3537      rcmail.addEventListener('menu-open', function(){ show_popup('listoptions'); }); 
    3638      rcmail.addEventListener('menu-save', save_listoptions); 
    3739//      rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui); 
    3840//      rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui); 
    39       rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); 
    40       $('#mailpreviewtoggle').addClass($('#mailpreviewframe').is(':visible') ? 'enabled' : 'closed').click(function(e){ toggle_preview_pane(e); return false }); 
     41 
     42      var previewframe = $('#mailpreviewframe').is(':visible'); 
     43      $('#mailpreviewtoggle').addClass(previewframe ? 'enabled' : 'closed').click(function(e){ toggle_preview_pane(e); return false }); 
    4144      $('#maillistmode').addClass(rcmail.env.threading ? '' : 'selected').click(function(e){ switch_view_mode('list'); return false }); 
    4245      $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e){ switch_view_mode('thread'); return false }); 
    43        
     46 
    4447      if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { 
    4548        layout_messageview(); 
     49      } 
     50      else if (rcmail.env.action == 'list' || !rcmail.env.action) { 
     51          mailviewsplit = new rcube_splitter({ id:'mailviewsplitter', p1:'#mailview-top', p2:'#mailview-bottom', 
     52            orientation:'h', relative:true, start:310, min:150, size:0, offset:-22 }); 
     53          if (previewframe) 
     54            mailviewsplit.init(); 
     55      } 
     56       
     57      if ($('#mailview-left').length) { 
     58        new rcube_splitter({ id:'mailviewsplitterv', p1:'#mailview-left', p2:'#mailview-right', 
     59          orientation:'v', relative:true, start:248, min:150, size:12, callback:render_mailboxlist, render:resize_leftcol }).init(); 
    4660      } 
    4761    } 
     
    5367      $(tab).addClass('selected') 
    5468        .children().first().removeAttr('onclick').click(function() { return false; }); 
     69 
     70      if (rcmail.env.action == 'folders') { 
     71        new rcube_splitter({ id:'folderviewsplitter', p1:'#folderslist', p2:'#folder-details', 
     72          orientation:'v', relative:true, start:305, min:150, size:12 }).init(); 
     73      } 
     74      else if (rcmail.env.action.indexOf('identit') >= 0) { 
     75        new rcube_splitter({ id:'identviewsplitter', p1:'#identitieslist', p2:'#identity-details', 
     76          orientation:'v', relative:true, start:305, min:150, size:12 }).init(); 
     77      } 
    5578    } 
    5679 
     
    107130  } 
    108131 
     132 
     133  function render_mailboxlist(splitter) 
     134  { 
     135  } 
     136 
     137 
     138  function resize_leftcol(splitter) 
     139  { 
     140    if (splitter) 
     141      $('#quicksearchbar input').css('width', (splitter.pos - 70) + 'px'); 
     142  } 
     143 
     144 
    109145  /** 
    110146   * Trigger for popup menus 
     
    188224 
    189225 
     226  /** 
     227   * Show/hide the preview pane 
     228   */ 
    190229  function toggle_preview_pane(e) 
    191230  { 
     
    193232      frame = $('#mailpreviewframe'), 
    194233      visible = !frame.is(':visible'), 
    195       splitter = parseInt(bw.get_cookie('mailviewsplitter') || 320), 
     234      splitter = mailviewsplit.pos || parseInt(bw.get_cookie('mailviewsplitter') || 320), 
    196235      topstyles, bottomstyles, uid; 
    197236 
     
    200239 
    201240    if (visible) { 
    202       topstyles = { height:(splitter-38)+'px', bottom:'auto' }; 
    203       bottomstyles = { top:(splitter+5)+'px', height:'auto' }; 
     241      $('#mailview-top').css({ bottom:'auto' }); 
     242      $('#mailview-bottom').css({ height:'auto' }); 
     243 
    204244      rcmail.env.contentframe = 'messagecontframe'; 
    205245      if (uid = rcmail.message_list.get_single_selection()) 
    206246        rcmail.show_message(uid, false, true); 
     247 
     248      // let the splitter set the correct size and position 
     249      if (mailviewsplit.handle) { 
     250        mailviewsplit.handle.show(); 
     251        mailviewsplit.resize(); 
     252      } 
     253      else 
     254        mailviewsplit.init(); 
    207255    } 
    208256    else { 
    209       topstyles = { height:'auto', bottom:'28px' }; 
    210       bottomstyles = { top:'auto', height:'26px' }; 
    211257      rcmail.env.contentframe = null; 
    212258      rcmail.show_contentframe(false); 
    213     } 
    214  
    215     $('#mailview-top').css(topstyles); 
    216     $('#mailview-bottom').css(bottomstyles); 
     259 
     260      $('#mailview-top').css({ height:'auto', bottom:'28px' }); 
     261      $('#mailview-bottom').css({ top:'auto', height:'26px' }); 
     262 
     263      if (mailviewsplit.handle) 
     264        mailviewsplit.handle.hide(); 
     265    } 
    217266 
    218267    if (visible && uid && rcmail.message_list) 
     
    223272 
    224273 
     274  /** 
     275   * 
     276   */ 
    225277  function switch_view_mode(mode) 
    226278  { 
     
    266318 
    267319 
     320  /** 
     321   * 
     322   */ 
    268323  function save_listoptions() 
    269324  { 
     
    280335 
    281336 
     337  /** 
     338   * 
     339   */ 
    282340  function set_searchmod(elem) 
    283341  { 
     
    326384} 
    327385 
     386 
     387 
     388/** 
     389 * Roundcube splitter GUI class 
     390 * 
     391 * @constructor 
     392 */ 
     393function rcube_splitter(p) 
     394{ 
     395  this.p = p; 
     396  this.id = p.id; 
     397  this.horizontal = (p.orientation == 'horizontal' || p.orientation == 'h'); 
     398  this.halfsize = (p.size !== undefined ? p.size : 10) / 2; 
     399  this.pos = p.start || 0; 
     400  this.min = p.min || 20; 
     401  this.offset = p.offset || 0; 
     402  this.relative = p.relative ? true : false; 
     403  this.drag_active = false; 
     404  this.render = p.render; 
     405  this.callback = p.callback; 
     406 
     407  var me = this; 
     408 
     409  this.init = function() 
     410  { 
     411    this.p1 = $(this.p.p1); 
     412    this.p2 = $(this.p.p2); 
     413 
     414    // create and position the handle for this splitter 
     415    this.p1pos = this.relative ? this.p1.position() : this.p1.offset(); 
     416    this.p2pos = this.relative ? this.p2.position() : this.p2.offset(); 
     417    this.handle = $('<div>') 
     418      .attr('id', this.id) 
     419      .attr('unselectable', 'on') 
     420      .addClass('splitter ' + (this.horizontal ? 'splitter-h' : 'splitter-v')) 
     421      .appendTo(this.p1.parent()) 
     422      .bind('mousedown', onDragStart); 
     423 
     424    if (this.horizontal) { 
     425      var top = this.p1pos.top + this.p1.outerHeight(); 
     426      this.handle.css({ left:'0px', top:top+'px' }); 
     427    } 
     428    else { 
     429      var left = this.p1pos.left + this.p1.outerWidth(); 
     430      this.handle.css({ left:left+'px', top:'0px' }); 
     431    } 
     432 
     433    this.elm = this.handle.get(0); 
     434 
     435    // listen to window resize on IE 
     436    if (bw.ie) 
     437      $(window).resize(function(e){ onResize(e) }); 
     438 
     439    // read saved position from cookie 
     440    var cookie = bw.get_cookie(this.id); 
     441    if (cookie && !isNaN(cookie)) { 
     442      this.pos = parseFloat(cookie); 
     443      this.resize(); 
     444    } 
     445    else if (this.pos) { 
     446      this.resize(); 
     447      this.set_cookie(); 
     448    } 
     449  }; 
     450 
     451  /** 
     452   * Set size and position of all DOM objects 
     453   * according to the saved splitter position 
     454   */ 
     455  this.resize = function() 
     456  { 
     457    if (this.horizontal) { 
     458      this.p1.css('height', Math.floor(this.pos - this.p1pos.top - this.halfsize) + 'px'); 
     459      this.p2.css('top', Math.ceil(this.pos + this.halfsize + 2) + 'px'); 
     460      this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px'); 
     461      if (bw.ie) { 
     462        var new_height = parseInt(this.p2.parent().outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0); 
     463        this.p2.css('height') = (new_height > 0 ? new_height : 0) + 'px'; 
     464      } 
     465    } 
     466    else { 
     467      this.p1.css('width', Math.floor(this.pos - this.p1pos.left - this.halfsize) + 'px'); 
     468      this.p2.css('left', Math.ceil(this.pos + this.halfsize) + 'px'); 
     469      this.handle.css('left', Math.round(this.pos - this.halfsize + this.offset + 3)+'px'); 
     470      if (bw.ie) { 
     471        var new_width = parseInt(this.p2.parent().outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ; 
     472        this.p2.css('width', (new_width > 0 ? new_width : 0) + 'px'); 
     473      } 
     474    } 
     475 
     476    this.p2.resize(); 
     477    this.p1.resize(); 
     478 
     479    if (typeof this.render == 'function') 
     480      this.render(this); 
     481  }; 
     482 
     483  /** 
     484   * Handler for mousedown events 
     485   */ 
     486  function onDragStart(e) 
     487  { 
     488    // disable text selection while dragging the splitter 
     489    if (bw.konq || bw.chrome || bw.safari) 
     490      document.body.style.webkitUserSelect = 'none'; 
     491 
     492    me.p1pos = me.relative ? me.p1.position() : me.p1.offset(); 
     493    me.p2pos = me.relative ? me.p2.position() : me.p2.offset(); 
     494    me.drag_active = true; 
     495 
     496    // start listening to mousemove events 
     497    $(document).bind('mousemove.'+this.id, onDrag).bind('mouseup.'+this.id, onDragStop); 
     498 
     499    // enable dragging above iframes 
     500    $('iframe').each(function() { 
     501      $('<div class="iframe-splitter-fix"></div>') 
     502        .css({ background: '#fff', 
     503          width: this.offsetWidth+'px', height: this.offsetHeight+'px', 
     504          position: 'absolute', opacity: '0.001', zIndex: 1000 
     505        }) 
     506        .css($(this).offset()) 
     507        .appendTo('body'); 
     508      }); 
     509  }; 
     510 
     511  /** 
     512   * Handler for mousemove events 
     513   */ 
     514  function onDrag(e) 
     515  { 
     516    if (!me.drag_active) 
     517      return false; 
     518 
     519    var pos = rcube_event.get_mouse_pos(e); 
     520 
     521    if (me.relative) { 
     522      var parent = me.p1.parent().offset(); 
     523      pos.x -= parent.left; 
     524      pos.y -= parent.top; 
     525    } 
     526 
     527    if (me.horizontal) { 
     528      if (((pos.y - me.halfsize) > me.p1pos.top) && ((pos.y + me.halfsize) < (me.p2pos.top + me.p2.outerHeight()))) { 
     529        me.pos = Math.max(me.min, pos.y - me.offset); 
     530        me.resize(); 
     531      } 
     532    } 
     533    else { 
     534      if (((pos.x - me.halfsize) > me.p1pos.left) && ((pos.x + me.halfsize) < (me.p2pos.left + me.p2.outerWidth()))) { 
     535        me.pos = Math.max(me.min, pos.x - me.offset); 
     536        me.resize(); 
     537      } 
     538    } 
     539 
     540    me.p1pos = me.relative ? me.p1.position() : me.p1.offset(); 
     541    me.p2pos = me.relative ? me.p2.position() : me.p2.offset(); 
     542    return false; 
     543  }; 
     544 
     545  /** 
     546   * Handler for mouseup events 
     547   */ 
     548  function onDragStop(e) 
     549  { 
     550    // resume the ability to highlight text 
     551    if (bw.konq || bw.chrome || bw.safari) 
     552      document.body.style.webkitUserSelect = 'auto'; 
     553 
     554    // cancel the listening for drag events 
     555    $(document).unbind('.'+me.id); 
     556    me.drag_active = false; 
     557 
     558    // remove temp divs 
     559    $('div.iframe-splitter-fix').each(function(){ this.parentNode.removeChild(this); }); 
     560 
     561    me.set_cookie(); 
     562 
     563    if (typeof me.callback == 'function') 
     564      me.callback(me); 
     565 
     566    return bw.safari ? true : rcube_event.cancel(e); 
     567  }; 
     568 
     569  /** 
     570   * Handler for window resize events 
     571   */ 
     572  function onResize(e) 
     573  { 
     574    if (me.horizontal) { 
     575      var new_height = parseInt(me.p2.parent().outerHeight(), 10) - parseInt(me.p2[0].style.top, 10) - (bw.ie8 ? 2 : 0); 
     576      me.p2.css('height', (new_height > 0 ? new_height : 0) +'px'); 
     577    } 
     578    else { 
     579      var new_width = parseInt(me.p2.parent().outerWidth(), 10) - parseInt(me.p2[0].style.left, 10); 
     580      me.p2.css('width', (new_width > 0 ? new_width : 0) + 'px'); 
     581    } 
     582  }; 
     583 
     584  /** 
     585   * Saves splitter position in cookie 
     586   */ 
     587  this.set_cookie = function() 
     588  { 
     589    var exp = new Date(); 
     590    exp.setYear(exp.getFullYear() + 1); 
     591    bw.set_cookie(this.id, this.pos, exp); 
     592  }; 
     593 
     594} // end class rcube_splitter 
     595 
     596 
Note: See TracChangeset for help on using the changeset viewer.