Roundcube Community Forum

SVN Releases => SVN Discussion => Topic started by: davo on March 14, 2007, 03:01:28 AM

Title: Expand/Collapse Folders on the 'Email' page
Post by: davo on March 14, 2007, 03:01:28 AM
Hi guys, I'm not sure if this is the right place to post this or not (apologies if it's not). I've done some work on expand/collapse for mail folders with some server-side stuff to remember the folder state between pageloads/sessions. There are 2 versions:

1 - Session Only
Folders remember their open/closed state for the duration of the session.
http://download.recurser.com/roundcubemail_r507_session_only.tar.gz

2- Database
Folders store their open/closed state in a new DB table ('folders') so they can maintain state between sessions.
http://download.recurser.com/roundcubemail_r507_with_new_table.tar.gz

I lean towards the second one because I've usually got a stupidly large amount of folders and i like to have them keep their open/closed state between sessions so I don't have to keep re-opening commonly used folders every time i log in.

The only problem with the second solution is that if folders are renamed/deleted in the 'Personal Settings->Folders' section there will be orphaned rows in the folders table (hope that makes sense!). I tried to alter the folder delete/rename so that the folders table would be kept up to date but folder rename seems to crash firefox & IE for me (connection timeout or something) so i just left it as is.

Feel free to use either (or neither!) as you see fit. Love roundcube - keep up the great work!

edit #1: i've only tested it in FireFox & IE6 on windows - would be cool if someone could give opera/mac/IE7 a go.
edit #2: sorry looks like i should have put this in the Plug-Ins forum, didn't see it before
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: seansan on March 14, 2007, 02:12:08 PM

How great?! This is a good contribution. maybe also log an issue referring to this in the tracker

http://trac.roundcube.net/trac.cgi/report
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on March 14, 2007, 08:18:51 PM
Thanks, i dropped a note in http://trac.roundcube.net/trac.cgi/ticket/1267231 - seems to be a feature request for this.
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: NaiosKae on March 22, 2007, 09:44:25 AM
Really good Improvement.

Works better than mine and your source code is also nicer ;p

Edit: after having replaced mine : result in FF 2.0 is :

(http://hypercube.dynalias.org/~naios/capture.22-03-2007.0.png)
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on March 24, 2007, 01:22:43 PM
Thanks for the feedback NaiosKae - are you on windows or mac, and what os version/screen resolution are you using? I've tried it out on IE6-7/Opera9/FF mac and windows, but obviously from your screenshot it's far from ok for you. i'd love to figure out how to reproduce this myself! Ideally should look like this:
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: NaiosKae on March 26, 2007, 04:53:12 AM
Hi,
I'm using Firefox 2.0.3 running under Linux debian Etch with a wide screen (1680x1050).
First time I used it, it was very nice, looking like your's but when I connected for the second time (after having updated my firefox to iceweasel meaning : 1.5 to 2.0.3), you can see on the screenshot.

result is strangely similary as the one I have with IE7 on my dirty solution of collapsing folders
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on March 26, 2007, 07:04:27 AM
Yeah i had a similar problem with IE6 before, the css got a little crazy trying to coax it into working. I think we've got a debian machine at work somewhere - I'll have a go tomorrow and see what it looks like. Is it ok on IE 6/7 and windows FF for you?

Thanks for your help!
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on March 28, 2007, 09:00:56 AM
Unfortunately the closest I could get to debian was an ubuntu edgy box, and it seemed to work ok in iceweasel on that. Is there any chance you could have a play with the css and try to figure out what's going on? As far as i can tell it's working in every other recent browser I can get my hands on. Also a bit odd that it worked the first time you loaded it, but not after that :( i'm a bit stumped on this
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: NaiosKae on April 03, 2007, 11:39:38 AM
Hi again,

after some other tries, behavior was the same on windows version of FF 2.0

in fact, the real strange thing is that it works well when window is in full-screen mode.

due to dimension of my screen (1680*1050 at home and 1900*1440 at work) my browser does never use the whole screen.

the display bug may stand in the geometry of wide-screens.


Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on April 11, 2007, 02:19:35 AM
Thanks NaiosKae, quite bizarre that it works in fullscreen mode but not otherwise. I'm kind of stumped and unfortunately i don't have access to a screen that big to reproduce this. Does the original code you wrote work at these resolutions? If you get time I'd love it if you could play around with the css and see if you can figure out what's happening. If I can get my hands on a big monitor I'll do the same.

Thanks again for the feedback!
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: NaiosKae on April 16, 2007, 05:14:58 AM
I tried again at work (1900x1440 screen), it works well
Same at home

I don't understand what happened, may be cache conflict ?

Edit : I've found what happend.

I replaced the link pointing on my version with a link pointing on yours.
my css data were conflicting with yours then I had the result shown above.
Even if I have a cache size of 0Mb on Firefox profiles, I had to empty it to make it works.
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on April 16, 2007, 07:19:23 AM
That's great, thanks for all your help NaiosKae! I'm going to have to get myself a bigger screen one of these days :)

Edit : I've updated everything to work with the latest 552 release ( http://download.recurser.com/roundcubemail_r552_session_only.tar.gz ) if anyone needs it
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: knuckles on June 07, 2007, 06:19:36 AM
Can you provide just the code for this? I'm trying to get it to work with SVN 607.
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on June 14, 2007, 04:48:04 AM
Sorry about the slow reply knuckles, i don't come here much. I've upped everything to version 620, you can grab it here if that helps you:

http://download.recurser.com/roundcubemail_r620_session_only.tar.gz

I'm not sure what you mean by 'provide just the code' ? There are changes to 4 existing files, 2 new files, and 2 images... do you want me to paste the changes in here or something?

Give me a shout if you need anything more

cheers

dave
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: Inferno on June 15, 2007, 08:32:31 AM
Installed the new version. Looks ok for now
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: flosoft on June 16, 2007, 12:03:28 PM
Maybe submit this to the Roundcube team. They could implement it into the SVN
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: Slug on June 17, 2007, 08:14:08 AM
Quote from: flosoft
Maybe submit this to the Roundcube team. They could implement it into the SVN

Very good idea

Michael
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on July 11, 2007, 03:52:05 AM
Quote from: Slug
Quote from: flosoft
Maybe submit this to the Roundcube team. They could implement it into the SVN

Very good idea

Michael
Thanks guys, i updated the expand/collapse trac ticket with this a while ago ( http://trac.roundcube.net/trac.cgi/ticket/1267231 ) - is there a better way to submit code? How does one normally go about doing it?

edit: updated to revision 648 :
http://download.recurser.com/roundcube/roundcubemail_r648_session_only.tar.gz
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: memoryhole on September 17, 2007, 06:13:33 PM
I love the work you did on collapsible folders! 8) What's the format of the database table that needs to be created? I think it has three columns (folder_name, user_id, is_open), but what are the types. Are they all varchars? ints?

I was thinking about a better solution to the problem of orphaned table entries when folders get renamed or such. It seems to me that just fixing the problem will require a bit more than just changing the delete/rename commands within roundcube, as most folks allow non-roundcube access to their email. Perhaps, at login (or logout (or both)), we can do a DB query to delete all entries for this user_id that don't have folder_names we recognize? How hard would such a thing be to hack into roundcube?

BTW, the problem that was reported about the display looking a little wonky is, I think, just a matter of not having applied the changes to the mail.css file.
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: davo on September 20, 2007, 01:49:28 AM
thanks memoryhole :) the schema should be in the SQL/mysql.update.sql file if you have the new-db-table version. Here's the diff if you don't have it :

Code: [Select]
--- SQL/mysql.update.sql    (revision 507)
+++ SQL/mysql.update.sql    (working copy)
@@ -9,3 +9,12 @@


 ALTER TABLE `identities`
  ADD `html_signature` tinyint(1) default 0 NOT NULL;
+
+CREATE TABLE IF NOT EXISTS `folders` (
+ `folder_id` int(10) unsigned NOT NULL auto_increment,
+ `folder_name` varchar(256) NOT NULL,
+ `user_id` int(10) unsigned NOT NULL default '0',
+ `is_open` tinyint(1) NOT NULL default '0',
+ PRIMARY KEY (`folder_id`),
+ KEY `User_ID_FK_folderss` (`user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;

You're spot on about people having 'non-roundcube access to their email', thats a problem for the folder-db-table stuff. Another way i was thinking of doing it is just to store a serialized array of folders that are open in the user preferences or something, so you don't need a folder table at all. I'm only using the session-based one at the moment so i probably won't do much with the folder-table stuff - if you come up with anything good let me know :)

cheers
Title: Re: Expand/Collapse Folders on the 'Email' page
Post by: Inferno on March 14, 2008, 06:32:13 AM
I updated the patch to the latest svn version:
http://rob.lensen.nu/files/roundcube/roundcubemail_r1192_session_only.tar.gz

Patch:
http://rob.lensen.nu/files/roundcube/roundcubemail_r1192_expand_folder.patch