Aleksander Machniak
2014-04-04 f8a9c2c59cda13e41f1295ce378885e29ad39780
skins/larry/ui.js
@@ -136,9 +136,9 @@
    /***  mail task  ***/
    if (rcmail.env.task == 'mail') {
      rcmail.addEventListener('menu-open', menu_open);
      rcmail.addEventListener('menu-save', menu_save);
      rcmail.addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') });
      rcmail.addEventListener('menu-open', menu_open)
        .addEventListener('menu-save', menu_save)
        .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') });
      var dragmenu = $('#dragmessagemenu');
      if (dragmenu.length) {
@@ -147,24 +147,28 @@
      }
      if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') {
        rcmail.addEventListener('enable-command', enable_command);
        rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); });
        rcmail.addEventListener('afterhide-headers', function() { layout_messageview(); });
        rcmail.addEventListener('enable-command', enable_command)
          .addEventListener('aftershow-headers', function() { layout_messageview(); })
          .addEventListener('afterhide-headers', function() { layout_messageview(); });
        $('#previewheaderstoggle').click(function(e){ toggle_preview_headers(); return false });
        // add menu link for each attachment
        $('#attachment-list > li').each(function() {
          $(this).append($('<a class="drop"></a>').click(function() { attachmentmenu(this); }));
        });
        if (get_pref('previewheaders') == '1') {
          toggle_preview_headers();
        }
      }
      else if (rcmail.env.action == 'compose') {
        rcmail.addEventListener('aftertoggle-editor', function(e){
          window.setTimeout(function(){ layout_composeview() }, 200);
          if (e && e.mode)
            $("select[name='editorSelector']").val(e.mode);
        });
        rcmail.addEventListener('aftersend-attachment', show_uploadform);
        rcmail.addEventListener('add-recipient', function(p){ show_header_row(p.field, true); });
        rcmail.addEventListener('aftersend-attachment', show_uploadform)
          .addEventListener('add-recipient', function(p){ show_header_row(p.field, true); })
          .addEventListener('aftertoggle-editor', function(e){
            window.setTimeout(function(){ layout_composeview() }, 200);
            if (e && e.mode)
              $("select[name='editorSelector']").val(e.mode);
          });
        // Show input elements with non-empty value
        var f, v, field, fields = ['cc', 'bcc', 'replyto', 'followupto'];
@@ -212,11 +216,9 @@
        if (previewframe)
          mailviewsplit.init();
        new rcube_scroller('#folderlist-content', '#folderlist-header', '#folderlist-footer');
        rcmail.addEventListener('setquota', update_quota);
        rcmail.addEventListener('enable-command', enable_command);
        rcmail.addEventListener('afterimport-messages', show_uploadform);
        rcmail.addEventListener('setquota', update_quota)
          .addEventListener('enable-command', enable_command)
          .addEventListener('afterimport-messages', show_uploadform);
      }
      else if (rcmail.env.action == 'get') {
        new rcube_splitter({ id:'mailpartsplitterv', p1:'#messagepartheader', p2:'#messagepartcontainer',
@@ -271,17 +273,15 @@
    }
    /***  addressbook task  ***/
    else if (rcmail.env.task == 'addressbook') {
      rcmail.addEventListener('afterupload-photo', show_uploadform);
      rcmail.addEventListener('beforepushgroup', push_contactgroup);
      rcmail.addEventListener('beforepopgroup', pop_contactgroup);
      rcmail.addEventListener('afterupload-photo', show_uploadform)
        .addEventListener('beforepushgroup', push_contactgroup)
        .addEventListener('beforepopgroup', pop_contactgroup);
      if (rcmail.env.action == '') {
        new rcube_splitter({ id:'addressviewsplitterd', p1:'#addressview-left', p2:'#addressview-right',
          orientation:'v', relative:true, start:226, min:150, size:12, render:resize_leftcol }).init();
        new rcube_splitter({ id:'addressviewsplitter', p1:'#addresslist', p2:'#contacts-box',
          orientation:'v', relative:true, start:286, min:270, size:12 }).init();
        new rcube_scroller('#directorylist-content', '#directorylist-header', '#directorylist-footer');
      }
      var dragmenu = $('#dragcontactmenu');
@@ -329,7 +329,7 @@
    });
    // set min-width to show all toolbar buttons
    var screen = $('body > div.minwidth');
    var screen = $('body.minwidth');
    if (screen.length) {
      screen.css('min-width', $('.toolbar').width() + $('#quicksearchbar').width() + $('#searchfilter').width() + 30);
    }
@@ -369,8 +369,10 @@
  function body_mouseup(e)
  {
    var config, obj, target = e.target;
    if (target.className == 'inner')
        target = e.target.parentNode;
    for (var id in popups) {
      obj = popups[id];
      config = popupconfig[id];
@@ -379,9 +381,10 @@
        && !config.toggle
        && (!config.editable || !target_overlaps(target, obj.get(0)))
        && (!config.sticky || !rcube_mouse_is_over(e, obj.get(0)))
        && !$(target).is('.folder-selector-link')
      ) {
        var myid = id+'';
        window.setTimeout(function(){ show_popupmenu(myid, false) }, 10);
        window.setTimeout(function() { show_popupmenu(myid, false); }, 10);
      }
    }
  }
@@ -718,6 +721,8 @@
      button.attr('href', '#hide').removeClass('add').addClass('remove')
    else
      button.attr('href', '#details').removeClass('remove').addClass('add')
    save_pref('previewheaders', full.is(':visible') ? '1' : '0');
  }
@@ -1205,6 +1210,7 @@
  {
    this.p1 = $(this.p.p1);
    this.p2 = $(this.p.p2);
    this.parent = this.p1.parent();
    // check if referenced elements exist, otherwise abort
    if (!this.p1.length || !this.p2.length)
@@ -1217,7 +1223,7 @@
      .attr('id', this.id)
      .attr('unselectable', 'on')
      .addClass('splitter ' + (this.horizontal ? 'splitter-h' : 'splitter-v'))
      .appendTo(this.p1.parent())
      .appendTo(this.parent)
      .bind('mousedown', onDragStart);
    if (this.horizontal) {
@@ -1256,7 +1262,7 @@
      this.p2.css('top', Math.ceil(this.pos + this.halfsize + 2) + 'px');
      this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px');
      if (bw.ie) {
        var new_height = parseInt(this.p2.parent().outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0);
        var new_height = parseInt(this.parent.outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0);
        this.p2.css('height', (new_height > 0 ? new_height : 0) + 'px');
      }
    }
@@ -1265,7 +1271,7 @@
      this.p2.css('left', Math.ceil(this.pos + this.halfsize) + 'px');
      this.handle.css('left', Math.round(this.pos - this.halfsize + this.offset + 3)+'px');
      if (bw.ie) {
        var new_width = parseInt(this.p2.parent().outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ;
        var new_width = parseInt(this.parent.outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ;
        this.p2.css('width', (new_width > 0 ? new_width : 0) + 'px');
      }
    }
@@ -1338,7 +1344,7 @@
    var pos = rcube_event.get_mouse_pos(e);
    if (me.relative) {
      var parent = me.p1.parent().offset();
      var parent = me.parent.offset();
      pos.x -= parent.left;
      pos.y -= parent.top;
    }
@@ -1346,12 +1352,18 @@
    if (me.horizontal) {
      if (((pos.y - me.halfsize) > me.p1pos.top) && ((pos.y + me.halfsize) < (me.p2pos.top + me.p2.outerHeight()))) {
        me.pos = Math.max(me.min, pos.y - me.offset);
        if (me.pos > me.min)
          me.pos = Math.min(me.pos, me.parent.height() - me.min);
        me.resize();
      }
    }
    else {
      if (((pos.x - me.halfsize) > me.p1pos.left) && ((pos.x + me.halfsize) < (me.p2pos.left + me.p2.outerWidth()))) {
        me.pos = Math.max(me.min, pos.x - me.offset);
        if (me.pos > me.min)
          me.pos = Math.min(me.pos, me.parent.width() - me.min);
        me.resize();
      }
    }
@@ -1390,11 +1402,11 @@
  function onResize(e)
  {
    if (me.horizontal) {
      var new_height = parseInt(me.p2.parent().outerHeight(), 10) - parseInt(me.p2[0].style.top, 10) - (bw.ie8 ? 2 : 0);
      var new_height = parseInt(me.parent.outerHeight(), 10) - parseInt(me.p2[0].style.top, 10) - (bw.ie8 ? 2 : 0);
      me.p2.css('height', (new_height > 0 ? new_height : 0) +'px');
    }
    else {
      var new_width = parseInt(me.p2.parent().outerWidth(), 10) - parseInt(me.p2[0].style.left, 10);
      var new_width = parseInt(me.parent.outerWidth(), 10) - parseInt(me.p2[0].style.left, 10);
      me.p2.css('width', (new_width > 0 ? new_width : 0) + 'px');
    }
  };