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

CommentFileSizeAuthor
#5 BOOK_CVS.txt11.3 KBPrometheus6
BOOK_4_6.txt6.87 KBPrometheus6

Comments

Steven’s picture

Status: Needs review » Active

First, 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.

puregin’s picture

This 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

Eric Scouten’s picture

I 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).

Prometheus6’s picture

Seriously, 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.

Prometheus6’s picture

Version: 4.6.0 » x.y.z
StatusFileSize
new11.3 KB

This 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.

Prometheus6’s picture

Random thought, though...I could add a hook_settings() implementation to choose between this and the standard handling.

urbanfalcon’s picture

I 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.

urbanfalcon’s picture

Why not just use

and to deprecate gracefully back to the single, gigantic dropdown? Worked for me...

urbanfalcon’s picture

UGH! It stripped my snippets out. ^^^ I was trying to say SCRIPT and NOSCRIPT, only html-style.

urbanfalcon’s picture

I 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.

puregin’s picture

urbanfalcon, 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

puregin’s picture

Prometheus6, 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

puregin’s picture

Prometheus6 - sorry, I didn't pay attention to your last comment about CVS :(

I'll roll this as a patch. Djun

puregin’s picture

OK, I'm really not functioning well - it's ALREADY a patch! Sigh. Please forgive. Djun

urbanfalcon’s picture

Well, 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.

urbanfalcon’s picture

Many 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.

Crell’s picture

Version: x.y.z » 6.x-dev
Status: Active » Fixed

Book module has been heavily rewritten for Drupal 6, and now includes an Ajaxy outline selector.

Anonymous’s picture

Status: Fixed » Closed (fixed)