Using the book.module to organize some 150 nodes, I found the parent select became unwieldy very quickly. Working on a site for my daughter, who wants to use the module to organize her fan fiction, I decided to fix that for her.
This patch splits the parent select into two levels: one to select the top-level book nodes, and one with only the children of the selected top-level node, to select the actual parent of the node you are working with. It inserts a bunch of really basic, dynamically generated Javascript to update the parent select and adds five new functions.
Patch is for version 4.6.2
Comments
Comment #1
Steven commentedFirst, new features are only added to CVS, not 4.6.
Though the idea behind this patch matches the overall structure of books (separated by top level item), the patch itself is unacceptable for core. JavaScript in core must degrade, I can see nothing that does that. It also doesn't match any of the JS conventions set in HEAD.
Comment #2
puregin commentedThis patch introduces some good ideas for dealing with significant issues in the administrative/outline aspect of book module.
I'd love to see this introduced to the HEAD branch, and the issue of graceful degradation of JavaScript addressed.
Please keep working on this!
Djun
Comment #3
Eric Scouten commentedI agree that parent select is unwieldy. I've been thinking about this question a lot recently. I think the common case is that you will have visited the parent page recently, so you might instead offer a popup menu with some arbitrary number of recently visited pages that could be parents (maybe 10 or 20).
Comment #4
Prometheus6 commentedSeriously, I don't think this functionality can exist if the browser has Javascript turned off. If I had know of the degradability issue (one that makes sense for core) I might have made it a project instead of a patch.
Comment #5
Prometheus6 commentedThis one is for CVS. The generated JS meets what I can see of the Javascript conventions in core. It also correctly handles the "add child page" link.
I'm posting this in case someone can figure out how to handle the case of a client that absolutely refuses to activate Javascript, and for those who may choose to use it.
Comment #6
Prometheus6 commentedRandom thought, though...I could add a hook_settings() implementation to choose between this and the standard handling.
Comment #7
urbanfalcon commentedI haven't tried this out yet, but this is something that definitely needs to be addressed (hopefully your patch does the job!). I'm working on an installation with about a thousand book nodes, and the parent dropdown is utterly useless now due to info-overload. Don't let this die...keep at it. Folks with larger data sets will be grateful.
Comment #8
urbanfalcon commentedWhy not just use
and to deprecate gracefully back to the single, gigantic dropdown? Worked for me...
Comment #9
urbanfalcon commentedUGH! It stripped my snippets out. ^^^ I was trying to say SCRIPT and NOSCRIPT, only html-style.
Comment #10
urbanfalcon commentedI combined your solution with a few others (http://drupal.org/node/40242) to come up with an upgraded "book plus" module for larger installations that would take the place of the original book.module. I don't know if it follows any of the drupal conventions, but it works in 4.6.x and is backwards compatible for folks without javascript...so I put it at my homepage if anyone wants to take a look.
Comment #11
puregin commentedurbanfalcon, please don't fork book module. Use the community process, contribute back :)
If you need help with generating patches or otherwise getting code contributed, please contact me.
Djun
Comment #12
puregin commentedPrometheus6, your patch sounds great.
However, new features get added to HEAD, not branches.
Could you supply your changes as patches to CVS HEAD for book.module? If you need help/advice about this, I'd be happy to help, just contact me.
Cheers, Djun
Comment #13
puregin commentedPrometheus6 - sorry, I didn't pay attention to your last comment about CVS :(
I'll roll this as a patch. Djun
Comment #14
puregin commentedOK, I'm really not functioning well - it's ALREADY a patch! Sigh. Please forgive. Djun
Comment #15
urbanfalcon commentedWell, unfortunately, the community is already on to 4.7.x beta and my system cannot handle beta testing. So, not much point in contributing the the core book module right now. The other alternative would be to hoard the code. However, if I did that then coders with 4.7.x systems would not be able to glean anything from what I did and make the next generation of book.module better.
If you have a means for me to update the 4.6.x branch without negatively affecting development on book.module 4.7.x, and you know someone who is a beta developer for 4.7.x that can make the upgrades to get it in the first stable 4.7.x release...please let me know. Otherwise, the only thing I can do is to temporarily make a "fork" as it were and merge it back in at a later date.
Comment #16
urbanfalcon commentedMany hours of work later, and I've managed to port what was cool about bookplus.module over to 4.7...and submitted it as a patch for review on book.module itself (http://drupal.org/node/62264). In addition to cascading dropdowns, there are in-form weight displays, a new weights assignment permission, and a few other beefy tidbits that live nicely together.
Comment #17
Crell commentedBook module has been heavily rewritten for Drupal 6, and now includes an Ajaxy outline selector.
Comment #18
(not verified) commented