Collapsible forum containers
grn - August 4, 2008 - 19:47
| Project: | Advanced Forum |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed |
| Issue tags: | Drupal 7.x |
Description
Development of collapsible forum containers functionality.
I think it would be cool to develop it with JS or JQuery. Michelle told me that JQuery would be the Drupal way. I will concentrate og figuring out JQuery and how to implement it with the advanced forum module.
Related resources: http://drupal.org/node/202542

#1
Thanks for doing this. :)
Michelle
#2
The first version of the collapsible forum container can be previewed here: http://grn.dk/drupal02/forum
I have only modified the advf-forum-list.tpl.php (attached), with a comment "collapsible container" every time I have modified something. This means that this is pretty ugly at the moment and the jQuery feature is static, inline, and it's only being tested on a forum with only 0-level/depth containers. There is some inline CSS that must be moved.
Next I will add a description of what I have done and a todo list.
Any comments or improvements are always welcome :-)
#3
wonderful! Can we add +/- icons?
#4
Changing status so I can find it easier. It may be a bit until I can get to this, unfortunately.
Michelle
#5
Hey Psicomante
Yes.
#6
Modified the two parts of this file. Attached images. I've learned a bit of jquery to make this patch, i hope that this "patch" is not so bad :)
I'm thinkin a way to add automatic ID and function to the containers. Icons path should be dynamic also (i think drupal_path functions or similar are the correct functions...i'll see API)
<div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a> <?php if ($forum->is_container) print "<span id=\"containerID-".$container."\" style=\"margin:0 1em 0 0; float: right;cursor: pointer;\"><img id='toggleImage-".$container."' src='sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif'></span>";?><!--collapsible container--></div><?php
//collapsible container jQuery
drupal_add_js (
'$(document).ready(function() {
$(\'#containerID-1\').click(function(){
$(\'.forum-child-1\').toggle();
if($(\'img#toggleImage-1\').attr("src") == \'sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif\'){
$("img#toggleImage-1").attr("src","sites/all/modules/advanced_forum/themes/advforum/images/maximize.gif");
}else{
$(\'img#toggleImage-1\').attr("src","sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif");
}
});
return false;
});',
'inline'
);
?>
#7
Hey Psicomante, it looks nice.
I tried it out.
Please validate your content at: http://validator.w3.org/
#8
I have attached a description of the patch so far.
To do list:
At all times respect the markup: Doctype: XHTML 1.0 Strict. Show how it works at a test site, currently at http://grn.dk/drupal02/forum , and adv forum settings at http://grn.dk/drupal02/admin/settings/advanced-forum.
At all times respect the development and don't make changes that ruin the current features (unless this is agreed by majority).
patch -p0 < advanced_forum_6.x-1.0-alpha2_collapsible_containers.patchfrom the sites/all/modules folderHmm I thought I could put this to do list at the top.... but failed. The description is not editable.
Note, the up to date files for my dev are here at comment #8.
#9
Very nice! Don't worry about making a patch top priority. I have some client work I need to do before I can work on the module again so it'll be a while before I can get it in anyway.
Thanks!
Michelle
#10
Ok, so I was supposed to do some client work this weekend but worked on advforum instead. So I got a bunch of stuff fixed and want to make a new set of alphas sometime this week. Any ETA on this? Do you think it will be ready to be included?
Thanks,
Michelle
#11
Hey.
I expected some more interest from others to support the development. It was intended as a kickstart. I will be working on this, but I don't think I will finish this week.
It could be included as it is. What do you need?
Thanks.
#12
Getting others to support development beyond saying "+1" can be hard... That's why I'm excited that you took on this part. ;)
If you think it's at a usable point, I just need the current code.
Thanks :)
Michelle
#13
For forum containers at level zero it works pretty fine.
The current code is in #8 (advf-forum-list.tpl_.php_.txt). Please specify if it should be presented to you otherwise.
#14
did you add my patch?
#15
I will add the patch if someone makes it XHTML valid.
#16
done it!
<div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a> <?php if ($forum->is_container) print "<span id=\"containerID-".$container."\" style=\"margin:0 1em 0 0; float: right;cursor: pointer;\"><img id='toggleImage-".$container."' src=\"sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif\" alt=\"Show or hide the forum\" /></span>";?><!--collapsible container--></div><?php
//collapsible container jQuery
drupal_add_js (
'$(document).ready(function() {
$(\'#containerID-1\').click(function(){
$(\'.forum-child-1\').toggle();
if($(\'img#toggleImage-1\').attr("src") == "sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif"){
$("img#toggleImage-1").attr("src","sites/all/modules/advanced_forum/themes/advforum/images/maximize.gif");
}else{
$(\'img#toggleImage-1\').attr("src","sites/all/modules/advanced_forum/themes/advforum/images/minimize.gif");
}
});
return false;
});',
'inline'
);
?>
#17
Nice work with the validation Psicomante.
We have an additional problem before this is applicable. We must have an intelligent way to identify which containers are collapsed or else we can get a problem with the +/- icons (attached: 2008-08-12_plusminus_bogus.jpg). The whole fun part about this patch is initially to collapse some or all containers. Your part assumes that all forums are uncollapsed.
*EDIT* I have attached advf-forum-list.tpl.php.plusminus_bogus.txt.
#18
i thought about it yesterday. I think there's a better way to do this: using css classes and recycle code from collapse function.
#19
#18
advf-forum-list.tpl_.php_.plusminus_bogus.txt
tested and also have the same issues/bugs
a nice implementation is here
http://gallery.menalto.com/forum
you can think some code functions to use "all shown" at the beginning or "all hidden" or "hide some individual" containers by an array of numbers for eatch container (eg 1,5,6,8...) for each forum list in that order
every new container can also follow a rule (new collapsed or shown) and then if needed, it can be included manualy in the code as (last) number in the array, just a simple idea.
#20
Gallery has a nice forum. We should spend more time studying it. We could apply some of the features as described here: http://codex.gallery2.org/GMC:Website:Collapsible_Forum_Containers
Remark, status and my latest dev files can be found at #8 (http://drupal.org/comment/reply/291084#comment-957056).
I will look into making a "real" patch now.
#21
Yeah, the Gallery forums have long been an inspiration to me. I actually have a copy of their theme from a while back so I could look at the custom code in the forum. (Not allowed to give it out, though.)
Just so you know, I'm not ignoring this issue. Just need to get the style revamp done before I can implement this.
Michelle
#22
I have added jQuery Cookie to remember collapse states of the containers (at #8).
It works fine in Firefox 3.01, but in Opera 9.50 the cookies are lost after browser restart (probably a strange browser setting).
Please report any errors encountered and guide me in the right direction, because I think the code I have written sucks ;-)
Next I am hoping to get the adv_forum settings page to display all containers and the abillity to collapse at default (not only all collapsed or expanded). I need to get the names and number of containers from the forum list at module level. I could use a hint from Michelle here or somebody else :-)
#23
Collapsible forum Status
Settings:
New features:
At #8 (http://drupal.org/node/291084#comment-957056).
#24
Great work! Are you sure to make jquery_plugin Module a "dependence" (i'm not sure this is the correct term)?
Are there the last patched files?
#25
Hey.
1) jQuery plugin module is required to get jQuery cookie to work. I am not sure I have answered your question?
2) I am not providing patched files anymore only patches. I am thinking of the unnecessary traffic.
#26
grn - Sorry, I missed your question. The forum container names can be gotten with variable_get('forum_containers', array());
Michelle
#27
Thanks, I will look into it.
#28
Just want to say thanks for your continuing work on this. I don't want you to get discouraged that it's not in, yet. I will add it. Just getting time to work on advforum has been rough lately. :(
Michelle
#29
The only way that i find is: save on profile or in other table a array of collapsed forum for every users. Mmmm is this so necessary?
@grn. I saw the todo list, but i haven't tried the patch yet. Is there something doesn't work?
#30
Michelle don't worry about that :-) I just needed this for my own benefit ;-)
Psicomante - I will add an option for admin to customize wich containers to collapse from the settings page. The latest version of the patch should work pretty well. I don't know about the cookies in some browsers. The adv forum will depend on jQuery plugins if this is implemented as it is. The big problem is that jQuery isn't quite ready for this yet. jQuery Cookie isn't implemented in jQuery plugins (http://drupal.org/node/298847). jQuery plugins will implement jQuery Cookie if the jQuery module is merged with jQuery plugins. The jQuery Cookie module won't answer my request. The status is random ;-) (http://drupal.org/node/298962).
#31
Find a nice way for users to specify which folders to collapse as default.
I am trying to get the forum container names from forum_containers.
$containers = variable_get('forum_containers', array());foreach ($containers as $container)echo $container." <br />";
But I am missing something here..... (not $container.. but something like $container->name).
#32
I'm getting close to being ready to tackle this but I'm confused on which code I should be using. Could you add a new comment with the latest code when you get a chance?
Michelle
#33
This is the latest patch.
#34
what about 5.x ?
#35
You could check out the patch, and try to implement the same changes to 5.x. I won't support 5.x...
#36
Ok, I spent quite some time tonight trying to work this patch in. Unfortunately, I can't use it as is so I've been trying to understand how it all works and put the pieces in the proper spots. I ran out of time tonight and don't want to commit my half done mangled mess but I wanted to let you know that I am at least working on it. :)
Michelle
#37
Ok, I've spent about two hours on this and I can't afford to take any more time for it right now. I appreciate your work, but this patch just isn't usable as is. Part of that is my fault as I've changed the .tpl so it doesn't apply but even besides that there are too many issues:
<a onclick="event.cancelBubble = true"doesn't appear related to this issue.I realize you did this for your own use and I understand if you don't want to take the time to fix it up for general use, but it would be great if you could since this is a feature I'd like to have included.
Thanks,
Michelle
#38
Actually, hold that thought. I was thinking about this in the shower and I think I have a much easier way to do this. My knowledge of jquery is rudimentary but I think it will work. I can't try it out until later today, though.
Michelle
#39
Hey.
I didn't know the Drupal coding standards, so it isn't the way it should be. One standard that annoys me is the "two space" tab, which I will fix in the future with search and replace. It's cool to have standards, but what it is the reason for this (out of topic - ignore ;-) )?
I put the jQuery inline because I didn't/don't know how to include it otherwise.
The goal is to implement this feature in the official advanced forum release, so it will be easier for me to maintain ;-)
I can work on the issues you mentioned if you like.
#40
Ok, I worked on this some more during nap time. I don't know jquery, but I have a general understanding of how it targets things so hopefully the changes I made will be helpful.
<span id="collapse-toggle-N">where N the TID of the containing container. This is for adding the +/- like you have in your class.These changes are in CVS and will be in the tarball in about 3 hours. I haven't added any of the jquery at this point. I'm hoping you can use these classes to target your jquery. If you're willing, I'd like to work together on this and have you write the jquery and just tell me what you need in the PHP end and I will make it happen. If you need more classes to be able to target things better, just let me know.
BTW, I read the Gallery page and figured out what that bubble bit was for. :)
Thanks again for your work on this. My intent isn't to just discard all your work. In fact, I've spent quite a bit of time studying it and trying to figure out what you did but the jquery is just beyond me at this point.
Michelle
#41
Thats Cool.
I don't have a personal relationship with my code. I just wan't things done :-)
I would be happy to work together with you on this. I think I will have some time tomorrow to work on this.
By the way, the icons (and most icons code) are provided by Psicomante.
#42
Sounds great. I'll make sure to add credit for the icons to Psicomante. I've got a second issue about documenting icon sources so it will be taken care of with that.
Michelle
#43
Thanks grn, but my work was very simple related to yours. Anyway i'm thinking about providing better icons for minimize and maximize. When they will be ready, i'll attach them here.
#44
Hmm, I have been working on this issue today.
I am not sure I have the right solution for this.
I figure that I we will need "something" to generate the dynamic jQuery code.
At first we could make something like this in advanced_forum.js:
$("#forum-list-N").click(function() {$(".in-container-N").toggle()
if($.cookie("cookie_container-N") !== "collapsed") {
$.cookie("cookie_container-N", "collapsed");
}
else {
$.cookie("cookie_container-N", "expanded");
}
});
Where N should be the tid, but how can I fetch that from the javascript file? Or should the jQuery functions be fetched by the php code somehow in the preprocess?
An other issue is to get jQuery cookie included. How do we plan to do that? In the old version it was handled by: jquery_plugin_add("cookie");
#45
I have attached a hardcoded .js. Collapsing works fine as far as I can test. The cookie function is not working.
#46
I tried rustling up someone on IRC that can help with this. No luck so far. Will try again this afternoon. I'm headed out of the house for a while.
Michelle
#47
Well you could generalize the function and set an event listener on the elements you want for the onclick (meaning it doesn't have to be a link/image - things like table rows should work)
I think to create that function for each topic would be bad, bad, bad.
#48
yuck... cookies everywhere? your users have to send those to the server on every request.
There's got to be a better way.
#49
Hmm I am not folowing you?
We aren't working on a function for each topic, it is bound to each container ID and every forum in that container as a CLASS.
It's cool that you think it's bad and yuck and you think there is a better way. Nobody has done it here before, but all suggestions are welcome.
By the way, the php working with javascript could be done with ajax, but i haven't worked with that yet.
#50
grn:
You asked how you could avoid hard-coding each collapse/expand call. I suggest making it a static function.
#51
cridenour - I don't know how this should work when the containers are dynamic. I think i am focusing in the wrong direction and this blinds my imagination.
#52
I'm rather working in the dark because I only have a theoretical knowledge of jquery, but...
How about if I put some sort of "onclick" code on each container's TR/TD that sends the TID to a jquery function? Since all the forum TRs are classed with in-container-TID you can to target them from that.
We'd also need a function on page load that will set up the collapsed state according to 1st the user's cookie and 2nd, if no cookie, the states set up by the admin. On the admin side, I can store a set of TIDs that should be collapsed. Assume any not in that set are uncollapsed. I don't know how jquery cookies work but it seems like you should be able to do the same there. So the onload jquery code would just read the set of collapsed containers and hide them.
Seems simple enough but, then, I don't know how to execute it so maybe I'm way off base. LOL
Thanks,
Michelle
#53
Michelle:
That is exactly how I would have approached.
I'll look into the jQuery later this evening.
#54
Thanks for clearing my mind :-)
I hope the folowing is going in the right direction.
In adv-forum-list.tpl.php add this code in the container element:
<?php print 'onClick="jq_collapse(\''.$child_id.'\')"';?>With the attached js file, we should have some functionality.
Please feedback on this when you get the time :-)
#55
I can't get that to work... Can you have a look at http://6dev.shellmultimedia.com/forum and tell me if I put the jquery in the right spot?
Michelle
#56
The collapsing is working here in Opera and Firefox (very buggy at the moment). It's just a test case.
You must click on the row twice.
#57
Well, color me confused. It is working for me, now, too. I can open and close them with just one click. So we just need something for the +/- icons, then. Awesome work!
Michelle
#58
nice approach..
can you please point a delicate way to load the javascript "advanced_forum.js" on 5.x (and 6.x if different)?
#59
@jannalexx - It's loaded via drupal_add_js.
@grn - Ok, so here's the "to do" as I see it:
Anything I'm missing? Are you able to tackle these?
Thanks!
Michelle
#60
Michelle: This should be simple. The right approach is a bit trickier....
We have an extra
</div>at line 94.Why do we want a span
<span id="collapse-toggle-<?php print $forum->container_id;?>"></span>and not an img?
<img id="collapse-toggle-<?php print $forum->container_id;?>" src="images/container_close.gif" alt="Show or hide the forum" />What is the path to container_close.gif?
I am still having problems with two click enabling the collapse function after page reload (browser cache could be preventing this bug from appearing).
#61
Two click bug is now fixed.. why didn't anybody see this??? ;-)
We don't need:
$('#forum-list-' + container_id).click(function() {when the function is called by onclick html. By the way it should be "onclick" not "onClick" my bad..#62
I found the path thing: drupal_get_path('module', 'advanced_forum')
#63
function advanced_forum_js_load() {
drupal_add_js(drupal_get_path('module', 'advanced_forum') .'/advanced_forum.js');
}
or
drupal_add_js("sites/all/modules/advanced_forum/advanced_forum.js", 'module');
But js can't be loaded
error: jq_collapse is not defined
(file is in the directory), whats the code in your side?
#64
jannalexx: in advanced_forum.module the you can add:
drupal_add_js(drupal_get_path('module', 'advanced_forum') . '/advanced_forum.js');to function advanced_forum_init() {
Have a look at the latest dev release.
#65
Add a function to set the initial collapsed state. This should look first at cookies and, if no cookies, at a list stored in a Drupal variable.
Hmm I reckon that this function should be loaded at dom.onload or something similar (http://www.geekdaily.net/2007/07/27/javascript-windowonload-is-bad-mkay/). I am struggling to find a way to send the php information to an onload javascript function? It was easy with the onclick, when my mind got cleared.
The initial collapse state is saved in cookies with jQuery.. maybe this should be handled by php...
By the way, I think the easiest approach will be to set cookie states for all the containers initially, only overriding user settings if they aren't set.
#66
@jannalexx - If you're curious about how this is being implemented, please just look at the code so we can keep the issue on topic.
@grn - I used a span instead of an image for the +/- because that is how you had it in your original code and I thought it needed to be that way. I changed it. You'll need to add the javascript to change from close to open as needed.
Setting cookies for the initial states sounds fine.
I have no idea how to send PHP to javascript. I'll see if I can rustle up some help for that.
Changes so far committed.
Thanks,
Michelle
#67
Sorry I disappeared the past few days!
I think grn is on the right approach. Have the JS read from the cookie. Have PHP set the cookie from the DB if one doesn't exist.
This way, you have the option of talking both ways (anything the JS does could eventually be read by the PHP).
#68
In
advanced_forum_init() {addjquery_plugin_add("cookie");.I have attached a new js file. This will change the image appropriately.
In the list.tpl.php you should have the looking like this:
<img id="collapse-toggle-<?php print $forum->container_id;?>" src="<?php printdrupal_get_path('module', 'advanced_forum') . '/styles/naked/images/container_close.gif';?>" alt="Show or hide the forum" />
This of course assumes initially expanded containers.
EDIT: The onclick:
<?php print 'onclick="jq_collapse(\''.$child_id.'\', \''.drupal_get_path('module', 'advanced_forum').'\')"';?>#69
jquery_plugin_add("cookie"); is undefined.
Heading out for a couple hours. If you can tell me how to fix that part, I'll commit the latest when I get back.
Thanks,
Michelle
#70
The jQuery plugins module must be installed.
The jQuery Cookie must be manually installed in jQuery plugins. The problem is stated at #30.
#71
@grn - Oh... Hrm... I missed that when I read through. Is that the only way to do it? If so, I guess I'll just wrap the call in a functon_exists so it doesn't fail for people who don't have the plugin.
Michelle
#72
You could make a duplicate of the jQuery Cookie js file and put it in the adv forum module.. but that's not the way it should be done ;-)
#73
No, I don't want to do that. I was wondering if there was any way to do it with the jquery available in core. If not, I guess I'll need to include instructions for adding this if people want it. Is there any way to make the +/- change on click so at least that's accurate without cookies?
Michelle
#74
We probably need the jQuery Cookie to communicate between php and jQuery. Without cookies and initial collapse function the container states are a mess. Unless we state that on every pageload, the containers are all collapsed or all expanded. Then the collapse function looses it's value.
#75
Ok, so how about this for a plan:
1) Initially assume all containers are open
2) I will put in the code to use jquery cookie but will check for the presense of the function. If it's there, the code will run to read the state of the forums from the cookie. If it's not there, this step will be skipped.
3) If the code to read the cookie exists but the cookie itself does not, prefill the cookie with the states from the Drupal variable.
4) When a user clicks to open/close a container, attempt to write it to the cookie and also target the icon to change it. This way the icon will change whether the cookie code is there or not. Of course, this won't be maintained between page refreshes if there is no cookie code.
Does this sound like a plan to you? If so, I believe all that I need from you is the code to change the icon on click. I think you have the rest of it working with the cookie if jquery cookie is installed, correct? Also, could you provide instructions for getting jquery cookie working with D6? You said something about copying the code to jquery plugins but I'm not sure what code and where it goes. It looks like the jquery plugins maintainer may be open to adding it but I need to test this in the mean time as I want to do an alpha in the next day or so and this is one of the last remaining issues.
Thanks,
Michelle
#76
Note to self: I also need to finish the work of making collapsable containers optional so I don't have to endure the wrath of Morbus. ;)
Michelle
#77
A) The icon change is in the js at #68... this should work when cookies are enabled, without the cookies the jQuery does not have a chance on figuring out the collapse state.
B) The major issue is getting the collapse state initially on page refresh. I don't know how to get the container_id's in the jQuery...
jQuery cookie:
1) get the jQueryCookie code: http://plugins.jquery.com/project/cookie
2) put it in the jquery_plugin folder and rename it to "jquery.cookie.min.js"
3) in advanced_forum.module put
jquery_plugin_add("cookie");infunction advanced_forum_init() {This should be it. This is not ready for alpha in my opinion.... primarily because of B).
Please let me know if you need more information. Sorry that I can't figure out the php/jQuery voodoo. I figure we need ajax or something, but I don't know much about it. Maybe some gurus could give us a hint... are we going in the right direction?
#78
A) I admit I don't know jquery but I know enough about it that I don't think it's impossible to toggle between two icons on click without using cookies. I'll see if I can find someone to help with that.
B) I don't, either. Let's see if I can rustle up some more help.
Thanks for the tips on getting the cookie working. Hopefully we can get this sorted. I can't keep holding off on this alpha. The last alpha was in June and that's way too long between.
Michelle
#79
A) Yes it worked that way in the early versions of my inline jQuery.. the image src changed every time a toggle was initiated.
#80
With this new info - I would suggest setting up a new page in your hook_menu to handle AJAX requests. So instead of cookies, you are just speaking to your database. Then on initial load, you can pull the data from the db and populate that into the .tpl file.
The only reason I suggest this route now is I was unaware (aka didn't read) that using cookies required an additional module. This is unacceptable for such a menial feature.
#81
@cridenour - Is this something you're able to help with? I know what hook_menu is but I'm really just out of my league with jquery/ajax. As much as I'd love to work through how to do it and learn how to use them, it's just not possible for me right now. Too much on my plate and I really need to get this working ASAP to replace the buggy alphas we have now. If you have the time to swoop in with a patch that makes this work without relying on jcookie or tons of code packed into the .tpl, that would be really awesome. I think we're close in the direction we're going but I just don't have the knowledge to push the rest of the way there.
Thanks,
Michelle
#82
I likely won't be able to write anything until the weekend. If that changes, I'm sure I'll be in IRC but have a presentation on Friday.
I'll check back here if my schedule opens up in the evenings.
#83
Attached patch goes against 6--1 Branch.
Basically we have an onload AJAX call and AJAX calls after each toggle. It sends it to PHP which handles the cookie (or creates on if it does not exist).
I still need to create the menus to allow the admin to set defaults. However - this could also be done by others - just need to pull down current categories, some checkboxes, serialize the results in a [category_id] => [boolean for collapsed] format :)
#84
Hmm just noticed I still have some debug comments in there as well...
And Michelle I will talk with you tomorrow on D5 roll - some of the jQuery changes I believe. I'll need to do some research during lunch.
#85
Yeah, I can handle the settings page. I was just waiting until this got sorted before adding it.
The patch looks good. I only have a few nits:
<div class="num num-topics"><?php print $forum->num_topics ?></div>I can take care of the first 3 myself later today if you don't get to it first. The last one needs your input, though. Thanks very much for doing this. :)
Michelle
#86
@2
I was following the advforum_topic_pager_max variable name ... any reason that isn't advanced_form?
@4
I wanted Eclipse to stop telling me there was an unclosed div... I meant to ask you about that. There is a mismatched # of divs in that section - there was no collapse reason for it, I just wanted the errors to go away :)
#87
@2 - That's an error, then. The rest are all advanced_forum. I'll fix that. A lot of those variables just got created on the fly when I decided something should be optional as I wrote it and I must have goofed with that one.
@4 - Interesting... There should be a closing div there so it's messed up somewhere else. I'll look thru it, thanks.
Michelle
#88
Ok, patch in #83 comitted. Thanks for jumping in, cridenour.
Remaining issues:
I can do #2 and probably #3 but I need help with #1.
Thanks,
Michelle
#89
Ok, #2 is done. Still need help with #1.
Michelle
#90
#1 done.
#91
When I apply this, the icon changes, which is great, but the states stop getting saved, which is not good. :(
Michelle
#92
On what browser? The fox? And I also noticed another little bug in my patch. Not seeing the problems you are though.
Will re-roll tonight.
#93
Yes, on FF3. All I did was apply the patch and clear the cache. The icon changed back and forth but as soon as I went to another page and came back, all containers were open again. Reverting the patch made it go back to remembering the container state.
Thanks,
Michelle
#94
User collapse states are forgotten at page refresh, confirmed in Opera 9.50 and FF 3.01. This is the cookie thing, didn't realize that this was implemented here.
Nice to see there is progress here :-) Keep up the good work!
#95
On the admin page (admin/settings/advanced-forum) the $options array was not reset after the theme selector dropdown.
Line 190 (approx) needs an:
$options = array();
before the loop before $form['advanced_forum_collapse_defaults'] = array(
It is currently:
Default collapsed containers:
[ ] naked
[ ] blue_lagoon
[ ] cat 1
...
I'll try to checkout the cvs version tonight and make a patch.
#96
@halkeye - Whoops. Missed that. No need to make a patch. I can fix it. Thanks for letting me know.
Michelle
#97
@cridenour - any progress on this? We're almost there. :)
Thanks,
Michelle
#98
In the last few lines, where it pulls the initial state - try chaning container_id to tid (the correct variable name in that function) That might be the problem here.
Sorry school started up and am organizing a Cincy drupal meetup tonight. :)
#99
At this point, collapsable containers are totally broken. I'm sure it's my fault. I applied a bunch of E_ALL notice patches from another issue and something in them broke it. But I don't know what happened or how to fix it. I need someone with jquery knowledge to go in and fix the goof and get this all working. Since this isn't likely to happen tonight, I'm going to hold this one over until after the alpha.
Michelle
#100
Every time I sat down with it, I got pulled away two-five minutes later. Not sure when my schedule will clear. But this is sitting up near the top when it does.
I agree on waiting though.
#101
I am going to be releasing a new alpha with just bugfixes as soon as I can get a hold of John Albin and fix the Zen subtheme problem. I need to either have these containers working or I'll need to pull the code out. I've had a couple of people complaining that the unfinished code is causing problems.
Is anyone going to have time to work on it this week?
Thanks,
Michelle
#102
Should link to the issues I'm duping for this to make sure all problems get fixed...
#317371: Advanced Forum error on page
#317008: Fatal error related with collapsible containers
I really could use help on this issue. I'm waiting on John's help with the Zen subtheme issue this week. Soon as we get that fixed, I'll be rolling a bugfix alpha. If no one has time to get this fixed, I'm just going to take all the code out until someone has time.
Michelle
#103
And another issue caused by this: #318256: Something is wrong with sitewide pager links
I've removed all of the code from both branches for collapsable containers. The work isn't lost as it's there in the CVS history. I don't have the js/ajax skills to do this. If someone wants to do this, I'm open to a patch provided it works, follows Drupal coding guidelines, and doesn't cause any of the issues that caused me to remove all the code.
Thanks to those of you who worked on the code. I do appreciate the effort but I can't leave code in there that causes problems, especially since the code wasn't yet to a working point.
Michelle
#104
Sorry I was pulled away from this. Considering I am unable to reproduce any of the errors on my site with the code I wrote against, like you said earlier, something was broken later on.
The pager links problem is even more confusing to me as it looks like it is appending the cookie to the URL. Maybe once school dies down again, I can approach the problem vs the latest build and find out what went wrong. This one seems to be an issue that might be in core as I'm not doing anything fancy with the cookie but that will have to wait for my schedule to die down.
Again, I apologize for being pulled away from this lately. As you can tell by my absence in IRC / groups.drupal etc, I am not just ignoring this :)
Chris
#105
I understand. Real life gets in the way of fun coding a lot. TBH, I don't see this as a critical feature. It's nice, sure, but we can live without it until we have a solid solution. The code is all out of the dev. If anyone is still having pager issues, be sure to clear your cookies.
I'm going to set this as a postponed feature request until you or some other jquery person can step up and take this home. :)
Thanks for all the time you folks have put into it.
Michelle
#106
Now that I have alpha 13 out, AF is open to new features again. If anyone wants to work on getting this into alpha 14, feel free. :)
Michelle
#107
Will this work on drupal 5?
I installed alpha 13 on my Drupal 5.12, but I didn't see the option "Default collapsed containers".
Thanks
#108
@akiecs - This won't work on either version until someone writes it.
Michelle
#109
Hi.
If someone wanted to continue the development of this feature, where should that person begin?
Is it possible to do further work on the buggy code you removed?
#110
grn - Sure. The code is all either in this issue or in cvs. You can use it as a starting point. I need to be firm on this one, though, because this issue sucked up far too much of my time for such a tiny feature. I'm only willing to look at completed, working patches that follow Drupal's coding standards so I can just apply, test, and commit. Normally I'm willing to spend time helping patches along but I've already spent that time on this one.
Michelle
#111
OK
#112
subscribing
#113
Will revisit this in 2.x.
Michelle
#114
#115
For you still interested in this, I found a nice site about solving this issue: http://www.tobypitman.com/multiple-collapsable-panels-with-cookies/
I've almost managed to get it to work on the forum, but there are still some problems with it, so I can't release my code-snippet yet.
I really like the approach, but I'm still struggling on how to access the right ul to hide for each container.
(See for yourself on the menu to the left on that site)
#116
Just an FYI: Now that each container is its own table, that may help with this. Now is a good time if anyone wants to have another go at a patch as I'm actively working on 2.x. I still don't know any javascript / jquery so this feature is relying on the community stepping up. :)
Michelle
#117
Good idea to give each container a table - might this also open the door to making them sortable?
I will happily test any collapsible patches once 2.x is a little more stable.
#118
@andrewsuth: No, they won't be sortable because they aren't created with theme_table.
Michelle
#119
Notes from IRC:
[10:53] $output = theme('ctools_collapsible', $title, $content, $collapsed);
[11:02] So it's still just a case of taking what's in theme_ctools_collapsible and re-organizing as you like. The handle is the clickable part, the content is the part that will go away. You'd want to provide a different toggle icon but that's doable with CSS easily enough.
[11:02] The javascript adds the toggle icon so it won't appear if .js isn't available.
Michelle
#120
sub
#121
Hello,
i am trying to create a patch for this feature. I tried ctools_collapsible, but that the theme function required a div element, but in the forum containers there is a table element.Thus it's not possible to use the ctools_collapsible unless it supports other html elements. So i think we have to write custom jquery code to support such a feature.
#122
I would prefer to use the CTools code since it's already a dependency. merlinofchaos is currently on vacation but I can talk to him about it after Drupalcon.
Thanks for looking at it,
Michelle
#123
I believe too, that using CTools is a much better solution than writing custom code. But unless ctools_collapsible supports table elements is not possible to use this function.
Thanks for your quick reply,
apanag
#124
Do we have any feedback on this?
apanag
#125
This commit should fix that: http://drupal.org/cvs?commit=261180
#126
Yes i think its perfect for now.
I think i ll be able to provide a patch for the collapsible blocks.
Thank you merlinofchaos, for your work.
#127
Awesome, thanks!
Michelle
#128
@merlinofchaos
I have some problems with the last version of the ctools.
We have an html structure with a table:
tablethead
tbody
We want the thead to be the $handle area and tbody to be the $content area. If we use the theme function theme_ctools_collapsible_remembered, we will be having a div area inside a table and that's not valid.
Finally the collapsible-div.js is looking always for div
Drupal.behaviors.CToolsCollapsible = function(context) {$('div.ctools-collapsible-container:not(.ctools-collapsible-processed)', context)
.each(Drupal.CTools.bindCollapsible)
.addClass('ctools-collapsible-processed');
}
Is it possible to check only for the classes and if there are the correct classes to provide the functionality?
For example if i manually wrote
<table class="ctools-collapsible-remember ctools-collapsible-container"><thead class="ctools-collapsible-handle">
<tr><th class="forum-icon"><span class="ctools-toggle"></span></th></tr>
</thead>
<tbody class="ctools-collapsible-content">
<tr><td><td></tr>
</tbody>
#129
Hello guys,
after working: http://drupal.org/node/558918 with merlinofchaos on ctools collapsed functionality, i created a patch to integrate collapsed areas into advanced_forum.module.
This is my first attempt and i am waiting your feedback. There is still one issue left for display correctly the table.
You have to use the latest dev release of ctools.
Many kudos to merlinofchaos for his hard work.
apanag
PS:
The patch is for naked style only.
#130
Thanks. I'll check this soon as I can. Going to be a very busy weekend and then I'm traveling so will likely be later next week.
Michelle
#131
Any ETA on when this will be working. We have over 10 containers with approximately 15 forums in each. We seriously need collapsable containers to clean up the look and feel of advanced forums.
Many Thanks
Samantha
#132
@SamanthaV : Well, you can always test the patch. The more eyes on it the better. I don't have any personal need for this so it would be great if people who do have a need stepped up to help. :)
Michelle
#133
With regret, moving this to D7.
Michelle
#134
I could test this for D6, i also have a need for this.
#135
2.x isn't final, yet. If someone provides a patch that works well, I'll apply it. So far, I haven't seen one. I don't have containers on my site so it's not something I am going to spend time trying to do at this point.
Michelle