Thomas Bruederli
2014-01-20 1bbf8c48868efb87baab7ae71721f2c9ad408e65
skins/larry/ui.js
@@ -41,6 +41,7 @@
  this.show_popup = show_popup;
  this.add_popup = add_popup;
  this.set_searchmod = set_searchmod;
  this.set_searchscope = set_searchscope;
  this.show_uploadform = show_uploadform;
  this.show_header_row = show_header_row;
  this.hide_header_row = hide_header_row;
@@ -136,9 +137,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 +148,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 +217,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 +274,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');
@@ -369,8 +370,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 +382,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 +722,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');
  }
@@ -726,11 +732,10 @@
   */
  function switch_view_mode(mode)
  {
    if (rcmail.env.threading != (mode == 'thread'))
      rcmail.set_list_options(null, undefined, undefined, mode == 'thread' ? 1 : 0);
    $('#maillistmode, #mailthreadmode').removeClass('selected');
    $('#mail'+mode+'mode').addClass('selected');
    if (!$('#mail'+mode+'mode').hasClass('disabled')) {
      $('#maillistmode, #mailthreadmode').removeClass('selected');
      $('#mail'+mode+'mode').addClass('selected');
    }
  }
@@ -756,11 +761,15 @@
        obj = popups['searchmenu'],
        list = $('input:checkbox[name="s_mods[]"]', obj),
        mbox = rcmail.env.mailbox,
        mods = rcmail.env.search_mods;
        mods = rcmail.env.search_mods,
        scope = rcmail.env.search_scope || 'base';
      if (rcmail.env.task == 'mail') {
        if (scope == 'all')
          mbox = '*';
        mods = mods[mbox] ? mods[mbox] : mods['*'];
        all = 'text';
        $('#s_scope_'+scope).prop('checked', true);
      }
      else {
        all = '*';
@@ -891,7 +900,11 @@
  {
    var all, m, task = rcmail.env.task,
      mods = rcmail.env.search_mods,
      mbox = rcmail.env.mailbox;
      mbox = rcmail.env.mailbox,
      scope = $('input[name="s_scope"]:checked').val();
    if (scope == 'all')
      mbox = '*';
    if (!mods)
      mods = {};
@@ -932,6 +945,11 @@
    });
  }
  function set_searchscope(elem)
  {
    rcmail.env.search_scope = elem.value;
  }
  function push_contactgroup(p)
  {
    // lets the contacts list swipe to the left, nice!