From 8bffd34e91fafad3ec4aad5ca5d0898907757763 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 20 Apr 2009 16:25:36 -0600 Subject: [PATCH] Bug #8127: Don't display expanding folders in special folders section --- imp/docs/CHANGES | 2 ++ imp/js/src/DimpBase.js | 83 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 25 deletions(-) diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 048eccfa7..39c0ba2d6 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,8 @@ v5.0-git -------- +[mms] Move subfolders of special folders to lower folder display tree in + DIMP (Bug #8127). [mms] Simplify quicksearch UI in DIMP. [mms] Improve notification display (DIMP). [mms] Use mailbox names in folder confirmation actions (DIMP) (Request #8162). diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index e0624f999..079e51bdd 100644 --- a/imp/js/src/DimpBase.js +++ b/imp/js/src/DimpBase.js @@ -1834,23 +1834,29 @@ var DimpBase = { _toggleSubFolder: function(base, mode) { base = $(base); - var opts = { + + var s, + id = base.readAttribute('id'), + opts = { duration: 0.2, queue: { position: 'end', scope: 'subfolder', limit: 2 } - }, - s = $(this.getSubFolderId(base.readAttribute('id'))); + }; + + /* Strip off the specialContainer suffix. */ + if (base.hasClassName('specialContainer')) { + id = id.slice(0, -8); + } + + s = $(this.getSubFolderId(id)); if (s && (mode == 'tog' || (mode == 'exp' && !s.visible()) || (mode == 'col' && s.visible()))) { - if (base.descendantOf('specialfolders')) { - opts.afterFinish = this._sizeFolderlist; - } base.firstDescendant().toggleClassName('exp').toggleClassName('col'); Effect.toggle(s, 'blind', opts); } @@ -1860,20 +1866,38 @@ var DimpBase = { // For format of the ob object, see DIMP::_createFolderElt(). createFolder: function(ob) { - var div, f_node, li, ll, parent_e, + var div, f_node, ftype, li, ll, parent_e, tmp, + cname = 'folder', fid = this.getFolderId(ob.m), label = ob.l || ob.m, mbox = decodeURIComponent(ob.m), submboxid = this.getSubFolderId(fid), submbox = $(submboxid), - ftype = ob.v ? (ob.co ? 'vcontainer' : 'virtual') : (ob.co ? 'container' : (ob.s ? 'special' : 'folder')); + title = mbox; + + if (ob.v) { + ftype = ob.co ? 'vcontainer' : 'virtual'; + title = label; + } else if (ob.co) { + ftype = 'container'; - div = new Element('DIV', { className: 'iconDiv ' + (ob.ch ? 'exp' : (ob.cl || 'base')), id: fid + '_div' }); + /* This is a dummy container element to display child elements of + * a mailbox displayed in the 'specialfolders' section. */ + if (ob.s) { + fid += '_special'; + ob.s = false; + cname += ' specialContainer'; + } + } else { + ftype = ob.s ? 'special' : 'folder'; + } + + div = new Element('DIV', { className: 'iconDiv', id: fid + '_div' }); if (ob.i) { div.setStyle({ backgroundImage: 'url("' + ob.i + '")' }); } - li = new Element('LI', { className: 'folder', id: fid, l: label, mbox: mbox, ftype: ftype }).insert(div).insert(new Element('A', { id: fid + '_label', title: label }).insert(label)); + li = new Element('LI', { className: cname, id: fid, l: label, mbox: mbox }).insert(div).insert(new Element('A', { id: fid + '_label', title: title }).insert(label)); // Now walk through the parent